{
 "cells": [
  {
   "cell_type": "markdown",
   "source": [
    "### 4.1.2. 激活函数"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "8d499a0bba45c793"
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import torch\n",
    "from d2l import torch as d2l"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-29T02:33:27.646382Z",
     "start_time": "2024-03-29T02:33:18.056334Z"
    }
   },
   "id": "b015fc92627a2d01",
   "execution_count": 1
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 4.1.2.1. ReLU函数"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "511e84a3bba1dcad"
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "<Figure size 500x250 with 1 Axes>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"317.954687pt\" height=\"180.25pt\" viewBox=\"0 0 317.954687 180.25\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2024-03-29T10:34:29.950873</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M 0 180.25 \nL 317.954687 180.25 \nL 317.954687 0 \nL 0 0 \nz\n\" style=\"fill: #ffffff\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 31.754688 145.8 \nL 310.754687 145.8 \nL 310.754687 7.2 \nL 31.754688 7.2 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g id=\"matplotlib.axis_1\">\n    <g id=\"xtick_1\">\n     <g id=\"line2d_1\">\n      <path d=\"M 44.436506 145.8 \nL 44.436506 7.2 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_2\">\n      <defs>\n       <path id=\"m85e546eca0\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m85e546eca0\" x=\"44.436506\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- -8 -->\n      <g transform=\"translate(39.436506 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-2d\" d=\"M 2975 2125 \nL 125 2125 \nL 125 2525 \nL 2975 2525 \nL 2975 2125 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"SimHei-38\" d=\"M 175 1375 \nQ 175 1675 325 1962 \nQ 475 2250 825 2425 \nQ 525 2600 425 2812 \nQ 325 3025 312 3300 \nQ 300 3575 387 3775 \nQ 475 3975 650 4150 \nQ 825 4325 1037 4387 \nQ 1250 4450 1500 4450 \nQ 1750 4450 1950 4400 \nQ 2150 4350 2375 4187 \nQ 2600 4025 2700 3725 \nQ 2800 3425 2687 3025 \nQ 2575 2625 2100 2400 \nQ 2525 2275 2700 2012 \nQ 2875 1750 2875 1375 \nQ 2875 1000 2762 775 \nQ 2650 550 2512 400 \nQ 2375 250 2137 162 \nQ 1900 75 1537 75 \nQ 1175 75 912 162 \nQ 650 250 475 425 \nQ 300 600 237 837 \nQ 175 1075 175 1375 \nz\nM 687 1400 \nQ 675 1100 787 875 \nQ 900 650 1200 587 \nQ 1500 525 1825 600 \nQ 2150 675 2275 950 \nQ 2400 1225 2362 1500 \nQ 2325 1775 2050 1962 \nQ 1775 2150 1450 2125 \nQ 1125 2100 912 1900 \nQ 700 1700 687 1400 \nz\nM 775 3350 \nQ 775 3100 950 2875 \nQ 1125 2650 1500 2650 \nQ 1875 2650 2062 2875 \nQ 2250 3100 2237 3412 \nQ 2225 3725 2012 3875 \nQ 1800 4025 1437 4000 \nQ 1075 3975 925 3787 \nQ 775 3600 775 3350 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-38\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_3\">\n      <path d=\"M 76.340452 145.8 \nL 76.340452 7.2 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_4\">\n      <g>\n       <use xlink:href=\"#m85e546eca0\" x=\"76.340452\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- -6 -->\n      <g transform=\"translate(71.340452 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-36\" d=\"M 250 1612 \nQ 275 1975 387 2225 \nQ 500 2475 725 2850 \nL 1750 4450 \nL 2325 4450 \nL 1275 2800 \nQ 1950 2975 2350 2750 \nQ 2750 2525 2887 2237 \nQ 3025 1950 3037 1612 \nQ 3050 1275 2937 950 \nQ 2825 625 2537 362 \nQ 2250 100 1737 75 \nQ 1225 50 862 262 \nQ 500 475 362 862 \nQ 225 1250 250 1612 \nz\nM 1025 787 \nQ 1250 550 1625 525 \nQ 2000 500 2250 775 \nQ 2500 1050 2500 1575 \nQ 2500 2100 2187 2300 \nQ 1875 2500 1487 2450 \nQ 1100 2400 925 2075 \nQ 750 1750 775 1387 \nQ 800 1025 1025 787 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-36\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_5\">\n      <path d=\"M 108.244397 145.8 \nL 108.244397 7.2 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_6\">\n      <g>\n       <use xlink:href=\"#m85e546eca0\" x=\"108.244397\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- -4 -->\n      <g transform=\"translate(103.244397 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-34\" d=\"M 2000 1100 \nL 75 1100 \nL 75 1525 \nL 2100 4450 \nL 2475 4450 \nL 2475 1525 \nL 3075 1525 \nL 3075 1100 \nL 2475 1100 \nL 2475 150 \nL 2000 150 \nL 2000 1100 \nz\nM 2000 1525 \nL 2000 3500 \nL 600 1525 \nL 2000 1525 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-34\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_4\">\n     <g id=\"line2d_7\">\n      <path d=\"M 140.148343 145.8 \nL 140.148343 7.2 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_8\">\n      <g>\n       <use xlink:href=\"#m85e546eca0\" x=\"140.148343\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_4\">\n      <!-- -2 -->\n      <g transform=\"translate(135.148343 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-32\" d=\"M 300 250 \nQ 325 625 650 925 \nQ 975 1225 1475 1862 \nQ 1975 2500 2125 2850 \nQ 2275 3200 2237 3450 \nQ 2200 3700 2000 3862 \nQ 1800 4025 1537 4000 \nQ 1275 3975 1037 3800 \nQ 800 3625 675 3275 \nL 200 3350 \nQ 400 3925 712 4187 \nQ 1025 4450 1450 4475 \nQ 1700 4500 1900 4462 \nQ 2100 4425 2312 4287 \nQ 2525 4150 2662 3875 \nQ 2800 3600 2762 3212 \nQ 2725 2825 2375 2287 \nQ 2025 1750 1025 600 \nL 2825 600 \nL 2825 150 \nL 300 150 \nL 300 250 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-32\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_5\">\n     <g id=\"line2d_9\">\n      <path d=\"M 172.052289 145.8 \nL 172.052289 7.2 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_10\">\n      <g>\n       <use xlink:href=\"#m85e546eca0\" x=\"172.052289\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_5\">\n      <!-- 0 -->\n      <g transform=\"translate(169.552289 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-30\" d=\"M 225 2537 \nQ 250 3200 412 3587 \nQ 575 3975 875 4225 \nQ 1175 4475 1612 4475 \nQ 2050 4475 2375 4112 \nQ 2700 3750 2800 3200 \nQ 2900 2650 2862 1937 \nQ 2825 1225 2612 775 \nQ 2400 325 1975 150 \nQ 1550 -25 1125 187 \nQ 700 400 525 750 \nQ 350 1100 275 1487 \nQ 200 1875 225 2537 \nz\nM 750 2687 \nQ 675 2000 800 1462 \nQ 925 925 1212 700 \nQ 1500 475 1800 612 \nQ 2100 750 2237 1162 \nQ 2375 1575 2375 2062 \nQ 2375 2550 2337 2950 \nQ 2300 3350 2112 3675 \nQ 1925 4000 1612 4012 \nQ 1300 4025 1062 3700 \nQ 825 3375 750 2687 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_6\">\n     <g id=\"line2d_11\">\n      <path d=\"M 203.956235 145.8 \nL 203.956235 7.2 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_12\">\n      <g>\n       <use xlink:href=\"#m85e546eca0\" x=\"203.956235\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_6\">\n      <!-- 2 -->\n      <g transform=\"translate(201.456235 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-32\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_7\">\n     <g id=\"line2d_13\">\n      <path d=\"M 235.860181 145.8 \nL 235.860181 7.2 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_14\">\n      <g>\n       <use xlink:href=\"#m85e546eca0\" x=\"235.860181\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_7\">\n      <!-- 4 -->\n      <g transform=\"translate(233.360181 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-34\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_8\">\n     <g id=\"line2d_15\">\n      <path d=\"M 267.764127 145.8 \nL 267.764127 7.2 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_16\">\n      <g>\n       <use xlink:href=\"#m85e546eca0\" x=\"267.764127\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 6 -->\n      <g transform=\"translate(265.264127 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-36\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_9\">\n     <g id=\"line2d_17\">\n      <path d=\"M 299.668073 145.8 \nL 299.668073 7.2 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_18\">\n      <g>\n       <use xlink:href=\"#m85e546eca0\" x=\"299.668073\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_9\">\n      <!-- 8 -->\n      <g transform=\"translate(297.168073 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-38\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_10\">\n     <!-- x -->\n     <g transform=\"translate(168.754687 171.8) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"SimHei-78\" d=\"M 2875 125 \nL 2275 125 \nL 1550 1200 \nL 825 125 \nL 225 125 \nL 1250 1550 \nL 300 2925 \nL 900 2925 \nL 1550 1875 \nL 2200 2925 \nL 2800 2925 \nL 1850 1550 \nL 2875 125 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#SimHei-78\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_19\">\n      <path d=\"M 31.754688 139.5 \nL 310.754687 139.5 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_20\">\n      <defs>\n       <path id=\"mc3b206d5af\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#mc3b206d5af\" x=\"31.754688\" y=\"139.5\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_11\">\n      <!-- 0 -->\n      <g transform=\"translate(19.754688 142.9375) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_21\">\n      <path d=\"M 31.754688 107.601264 \nL 310.754687 107.601264 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_22\">\n      <g>\n       <use xlink:href=\"#mc3b206d5af\" x=\"31.754688\" y=\"107.601264\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_12\">\n      <!-- 2 -->\n      <g transform=\"translate(19.754688 111.038764) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-32\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_23\">\n      <path d=\"M 31.754688 75.702529 \nL 310.754687 75.702529 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_24\">\n      <g>\n       <use xlink:href=\"#mc3b206d5af\" x=\"31.754688\" y=\"75.702529\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_13\">\n      <!-- 4 -->\n      <g transform=\"translate(19.754688 79.140029) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-34\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_4\">\n     <g id=\"line2d_25\">\n      <path d=\"M 31.754688 43.803793 \nL 310.754687 43.803793 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_26\">\n      <g>\n       <use xlink:href=\"#mc3b206d5af\" x=\"31.754688\" y=\"43.803793\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_14\">\n      <!-- 6 -->\n      <g transform=\"translate(19.754688 47.241293) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-36\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_5\">\n     <g id=\"line2d_27\">\n      <path d=\"M 31.754688 11.905057 \nL 310.754687 11.905057 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_28\">\n      <g>\n       <use xlink:href=\"#mc3b206d5af\" x=\"31.754688\" y=\"11.905057\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_15\">\n      <!-- 8 -->\n      <g transform=\"translate(19.754688 15.342557) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-38\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_16\">\n     <!-- relu(x) -->\n     <g transform=\"translate(14.504688 94) rotate(-90) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"SimHei-72\" d=\"M 2500 2425 \nQ 2025 2500 1700 2287 \nQ 1375 2075 1150 1550 \nL 1150 125 \nL 650 125 \nL 650 2925 \nL 1150 2925 \nL 1150 2200 \nQ 1375 2600 1712 2787 \nQ 2050 2975 2500 2975 \nL 2500 2425 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-65\" d=\"M 2850 1075 \nQ 2800 625 2450 350 \nQ 2100 75 1625 75 \nQ 1025 75 637 462 \nQ 250 850 250 1525 \nQ 250 2200 637 2587 \nQ 1025 2975 1625 2975 \nQ 2150 2975 2487 2637 \nQ 2825 2300 2825 1525 \nL 800 1525 \nQ 800 975 1037 750 \nQ 1275 525 1625 525 \nQ 1900 525 2075 662 \nQ 2250 800 2300 1075 \nL 2850 1075 \nz\nM 2250 1925 \nQ 2200 2275 2025 2412 \nQ 1850 2550 1575 2550 \nQ 1325 2550 1125 2412 \nQ 925 2275 825 1925 \nL 2250 1925 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-6c\" d=\"M 1825 125 \nL 1325 125 \nL 1325 4400 \nL 1825 4400 \nL 1825 125 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-75\" d=\"M 2800 125 \nL 2300 125 \nL 2300 650 \nQ 2100 375 1862 225 \nQ 1625 75 1250 75 \nQ 800 75 575 325 \nQ 350 575 350 950 \nL 350 2925 \nL 850 2925 \nL 850 1125 \nQ 850 825 1000 650 \nQ 1150 475 1400 475 \nQ 1725 475 2012 812 \nQ 2300 1150 2300 1650 \nL 2300 2925 \nL 2800 2925 \nL 2800 125 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-28\" d=\"M 2975 -200 \nL 2700 -475 \nQ 2075 125 1762 775 \nQ 1450 1425 1450 2250 \nQ 1450 3075 1762 3725 \nQ 2075 4375 2700 5000 \nL 2975 4725 \nQ 2400 4175 2112 3587 \nQ 1825 3000 1825 2250 \nQ 1825 1500 2112 912 \nQ 2400 325 2975 -200 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-29\" d=\"M 1675 2250 \nQ 1675 1425 1362 775 \nQ 1050 125 425 -475 \nL 150 -200 \nQ 725 325 1012 912 \nQ 1300 1500 1300 2250 \nQ 1300 3000 1012 3587 \nQ 725 4175 150 4725 \nL 425 5000 \nQ 1050 4375 1362 3725 \nQ 1675 3075 1675 2250 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#SimHei-72\"/>\n      <use xlink:href=\"#SimHei-65\" x=\"50\"/>\n      <use xlink:href=\"#SimHei-6c\" x=\"100\"/>\n      <use xlink:href=\"#SimHei-75\" x=\"150\"/>\n      <use xlink:href=\"#SimHei-28\" x=\"200\"/>\n      <use xlink:href=\"#SimHei-78\" x=\"250\"/>\n      <use xlink:href=\"#SimHei-29\" x=\"300\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"line2d_29\">\n    <path d=\"M 44.436506 139.5 \nL 172.052289 139.5 \nL 298.072869 13.5 \nL 298.072869 13.5 \n\" clip-path=\"url(#p4a611231e6)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 31.754688 145.8 \nL 31.754688 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_4\">\n    <path d=\"M 310.754687 145.8 \nL 310.754687 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 31.754688 145.8 \nL 310.754688 145.8 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 31.754688 7.2 \nL 310.754688 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"p4a611231e6\">\n   <rect x=\"31.754688\" y=\"7.2\" width=\"279\" height=\"138.6\"/>\n  </clipPath>\n </defs>\n</svg>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = torch.arange(-8.0, 8.0, 0.1, requires_grad=True)\n",
    "y = torch.relu(x)\n",
    "d2l.plot(x.detach(), y.detach(), 'x', 'relu(x)', figsize=(5, 2.5))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-29T02:34:30.014598Z",
     "start_time": "2024-03-29T02:34:29.709685Z"
    }
   },
   "id": "cf444535638463af",
   "execution_count": 2
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "<Figure size 500x250 with 1 Axes>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"327.603125pt\" height=\"180.25pt\" viewBox=\"0 0 327.603125 180.25\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2024-03-29T10:36:01.809076</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M -0 180.25 \nL 327.603125 180.25 \nL 327.603125 0 \nL -0 0 \nz\n\" style=\"fill: #ffffff\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 41.403125 145.8 \nL 320.403125 145.8 \nL 320.403125 7.2 \nL 41.403125 7.2 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g id=\"matplotlib.axis_1\">\n    <g id=\"xtick_1\">\n     <g id=\"line2d_1\">\n      <path d=\"M 54.084943 145.8 \nL 54.084943 7.2 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_2\">\n      <defs>\n       <path id=\"mda7cbae17e\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#mda7cbae17e\" x=\"54.084943\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- -8 -->\n      <g transform=\"translate(49.084943 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-2d\" d=\"M 2975 2125 \nL 125 2125 \nL 125 2525 \nL 2975 2525 \nL 2975 2125 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"SimHei-38\" d=\"M 175 1375 \nQ 175 1675 325 1962 \nQ 475 2250 825 2425 \nQ 525 2600 425 2812 \nQ 325 3025 312 3300 \nQ 300 3575 387 3775 \nQ 475 3975 650 4150 \nQ 825 4325 1037 4387 \nQ 1250 4450 1500 4450 \nQ 1750 4450 1950 4400 \nQ 2150 4350 2375 4187 \nQ 2600 4025 2700 3725 \nQ 2800 3425 2687 3025 \nQ 2575 2625 2100 2400 \nQ 2525 2275 2700 2012 \nQ 2875 1750 2875 1375 \nQ 2875 1000 2762 775 \nQ 2650 550 2512 400 \nQ 2375 250 2137 162 \nQ 1900 75 1537 75 \nQ 1175 75 912 162 \nQ 650 250 475 425 \nQ 300 600 237 837 \nQ 175 1075 175 1375 \nz\nM 687 1400 \nQ 675 1100 787 875 \nQ 900 650 1200 587 \nQ 1500 525 1825 600 \nQ 2150 675 2275 950 \nQ 2400 1225 2362 1500 \nQ 2325 1775 2050 1962 \nQ 1775 2150 1450 2125 \nQ 1125 2100 912 1900 \nQ 700 1700 687 1400 \nz\nM 775 3350 \nQ 775 3100 950 2875 \nQ 1125 2650 1500 2650 \nQ 1875 2650 2062 2875 \nQ 2250 3100 2237 3412 \nQ 2225 3725 2012 3875 \nQ 1800 4025 1437 4000 \nQ 1075 3975 925 3787 \nQ 775 3600 775 3350 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-38\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_3\">\n      <path d=\"M 85.988889 145.8 \nL 85.988889 7.2 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_4\">\n      <g>\n       <use xlink:href=\"#mda7cbae17e\" x=\"85.988889\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- -6 -->\n      <g transform=\"translate(80.988889 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-36\" d=\"M 250 1612 \nQ 275 1975 387 2225 \nQ 500 2475 725 2850 \nL 1750 4450 \nL 2325 4450 \nL 1275 2800 \nQ 1950 2975 2350 2750 \nQ 2750 2525 2887 2237 \nQ 3025 1950 3037 1612 \nQ 3050 1275 2937 950 \nQ 2825 625 2537 362 \nQ 2250 100 1737 75 \nQ 1225 50 862 262 \nQ 500 475 362 862 \nQ 225 1250 250 1612 \nz\nM 1025 787 \nQ 1250 550 1625 525 \nQ 2000 500 2250 775 \nQ 2500 1050 2500 1575 \nQ 2500 2100 2187 2300 \nQ 1875 2500 1487 2450 \nQ 1100 2400 925 2075 \nQ 750 1750 775 1387 \nQ 800 1025 1025 787 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-36\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_5\">\n      <path d=\"M 117.892835 145.8 \nL 117.892835 7.2 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_6\">\n      <g>\n       <use xlink:href=\"#mda7cbae17e\" x=\"117.892835\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- -4 -->\n      <g transform=\"translate(112.892835 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-34\" d=\"M 2000 1100 \nL 75 1100 \nL 75 1525 \nL 2100 4450 \nL 2475 4450 \nL 2475 1525 \nL 3075 1525 \nL 3075 1100 \nL 2475 1100 \nL 2475 150 \nL 2000 150 \nL 2000 1100 \nz\nM 2000 1525 \nL 2000 3500 \nL 600 1525 \nL 2000 1525 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-34\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_4\">\n     <g id=\"line2d_7\">\n      <path d=\"M 149.796781 145.8 \nL 149.796781 7.2 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_8\">\n      <g>\n       <use xlink:href=\"#mda7cbae17e\" x=\"149.796781\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_4\">\n      <!-- -2 -->\n      <g transform=\"translate(144.796781 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-32\" d=\"M 300 250 \nQ 325 625 650 925 \nQ 975 1225 1475 1862 \nQ 1975 2500 2125 2850 \nQ 2275 3200 2237 3450 \nQ 2200 3700 2000 3862 \nQ 1800 4025 1537 4000 \nQ 1275 3975 1037 3800 \nQ 800 3625 675 3275 \nL 200 3350 \nQ 400 3925 712 4187 \nQ 1025 4450 1450 4475 \nQ 1700 4500 1900 4462 \nQ 2100 4425 2312 4287 \nQ 2525 4150 2662 3875 \nQ 2800 3600 2762 3212 \nQ 2725 2825 2375 2287 \nQ 2025 1750 1025 600 \nL 2825 600 \nL 2825 150 \nL 300 150 \nL 300 250 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-32\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_5\">\n     <g id=\"line2d_9\">\n      <path d=\"M 181.700727 145.8 \nL 181.700727 7.2 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_10\">\n      <g>\n       <use xlink:href=\"#mda7cbae17e\" x=\"181.700727\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_5\">\n      <!-- 0 -->\n      <g transform=\"translate(179.200727 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-30\" d=\"M 225 2537 \nQ 250 3200 412 3587 \nQ 575 3975 875 4225 \nQ 1175 4475 1612 4475 \nQ 2050 4475 2375 4112 \nQ 2700 3750 2800 3200 \nQ 2900 2650 2862 1937 \nQ 2825 1225 2612 775 \nQ 2400 325 1975 150 \nQ 1550 -25 1125 187 \nQ 700 400 525 750 \nQ 350 1100 275 1487 \nQ 200 1875 225 2537 \nz\nM 750 2687 \nQ 675 2000 800 1462 \nQ 925 925 1212 700 \nQ 1500 475 1800 612 \nQ 2100 750 2237 1162 \nQ 2375 1575 2375 2062 \nQ 2375 2550 2337 2950 \nQ 2300 3350 2112 3675 \nQ 1925 4000 1612 4012 \nQ 1300 4025 1062 3700 \nQ 825 3375 750 2687 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_6\">\n     <g id=\"line2d_11\">\n      <path d=\"M 213.604673 145.8 \nL 213.604673 7.2 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_12\">\n      <g>\n       <use xlink:href=\"#mda7cbae17e\" x=\"213.604673\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_6\">\n      <!-- 2 -->\n      <g transform=\"translate(211.104673 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-32\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_7\">\n     <g id=\"line2d_13\">\n      <path d=\"M 245.508618 145.8 \nL 245.508618 7.2 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_14\">\n      <g>\n       <use xlink:href=\"#mda7cbae17e\" x=\"245.508618\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_7\">\n      <!-- 4 -->\n      <g transform=\"translate(243.008618 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-34\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_8\">\n     <g id=\"line2d_15\">\n      <path d=\"M 277.412564 145.8 \nL 277.412564 7.2 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_16\">\n      <g>\n       <use xlink:href=\"#mda7cbae17e\" x=\"277.412564\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 6 -->\n      <g transform=\"translate(274.912564 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-36\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_9\">\n     <g id=\"line2d_17\">\n      <path d=\"M 309.31651 145.8 \nL 309.31651 7.2 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_18\">\n      <g>\n       <use xlink:href=\"#mda7cbae17e\" x=\"309.31651\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_9\">\n      <!-- 8 -->\n      <g transform=\"translate(306.81651 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-38\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_10\">\n     <!-- x -->\n     <g transform=\"translate(178.403125 171.8) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"SimHei-78\" d=\"M 2875 125 \nL 2275 125 \nL 1550 1200 \nL 825 125 \nL 225 125 \nL 1250 1550 \nL 300 2925 \nL 900 2925 \nL 1550 1875 \nL 2200 2925 \nL 2800 2925 \nL 1850 1550 \nL 2875 125 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#SimHei-78\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_19\">\n      <path d=\"M 41.403125 139.5 \nL 320.403125 139.5 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_20\">\n      <defs>\n       <path id=\"mf0cba327db\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#mf0cba327db\" x=\"41.403125\" y=\"139.5\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_11\">\n      <!-- 0.0 -->\n      <g transform=\"translate(19.403125 142.9375) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-2e\" d=\"M 1075 125 \nL 500 125 \nL 500 675 \nL 1075 675 \nL 1075 125 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_21\">\n      <path d=\"M 41.403125 114.3 \nL 320.403125 114.3 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_22\">\n      <g>\n       <use xlink:href=\"#mf0cba327db\" x=\"41.403125\" y=\"114.3\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_12\">\n      <!-- 0.2 -->\n      <g transform=\"translate(19.403125 117.7375) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-32\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_23\">\n      <path d=\"M 41.403125 89.1 \nL 320.403125 89.1 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_24\">\n      <g>\n       <use xlink:href=\"#mf0cba327db\" x=\"41.403125\" y=\"89.1\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_13\">\n      <!-- 0.4 -->\n      <g transform=\"translate(19.403125 92.5375) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-34\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_4\">\n     <g id=\"line2d_25\">\n      <path d=\"M 41.403125 63.9 \nL 320.403125 63.9 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_26\">\n      <g>\n       <use xlink:href=\"#mf0cba327db\" x=\"41.403125\" y=\"63.9\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_14\">\n      <!-- 0.6 -->\n      <g transform=\"translate(19.403125 67.3375) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-36\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_5\">\n     <g id=\"line2d_27\">\n      <path d=\"M 41.403125 38.7 \nL 320.403125 38.7 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_28\">\n      <g>\n       <use xlink:href=\"#mf0cba327db\" x=\"41.403125\" y=\"38.7\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_15\">\n      <!-- 0.8 -->\n      <g transform=\"translate(19.403125 42.1375) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-38\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_6\">\n     <g id=\"line2d_29\">\n      <path d=\"M 41.403125 13.5 \nL 320.403125 13.5 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_30\">\n      <g>\n       <use xlink:href=\"#mf0cba327db\" x=\"41.403125\" y=\"13.5\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_16\">\n      <!-- 1.0 -->\n      <g transform=\"translate(19.403125 16.9375) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-31\" d=\"M 1400 3600 \nQ 1075 3275 575 2975 \nL 575 3450 \nQ 1200 3875 1600 4450 \nL 1900 4450 \nL 1900 150 \nL 1400 150 \nL 1400 3600 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-31\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_17\">\n     <!-- grad of relu -->\n     <g transform=\"translate(14.153125 106.5) rotate(-90) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"SimHei-67\" d=\"M 2975 2500 \nQ 2800 2550 2637 2562 \nQ 2475 2575 2300 2525 \nQ 2375 2450 2425 2337 \nQ 2475 2225 2475 2000 \nQ 2475 1575 2187 1300 \nQ 1900 1025 1475 1025 \nQ 1375 1025 1212 1062 \nQ 1050 1100 950 1150 \nQ 875 1100 850 1050 \nQ 825 1000 825 925 \nQ 825 800 1000 737 \nQ 1175 675 1625 675 \nQ 2350 675 2612 475 \nQ 2875 275 2875 -25 \nQ 2875 -425 2487 -612 \nQ 2100 -800 1575 -800 \nQ 900 -800 575 -625 \nQ 250 -450 250 -150 \nQ 250 0 375 150 \nQ 500 300 700 400 \nQ 550 475 462 587 \nQ 375 700 375 875 \nQ 375 1025 487 1137 \nQ 600 1250 750 1325 \nQ 625 1450 550 1625 \nQ 475 1800 475 2000 \nQ 475 2425 762 2700 \nQ 1050 2975 1475 2975 \nQ 1700 2975 1862 2912 \nQ 2025 2850 2150 2725 \nQ 2350 2875 2550 2937 \nQ 2750 3000 2975 2975 \nL 2975 2500 \nz\nM 1975 2000 \nQ 1975 2250 1850 2400 \nQ 1725 2550 1475 2550 \nQ 1225 2550 1100 2400 \nQ 975 2250 975 2000 \nQ 975 1750 1100 1600 \nQ 1225 1450 1475 1450 \nQ 1725 1450 1850 1600 \nQ 1975 1750 1975 2000 \nz\nM 2400 -75 \nQ 2400 25 2287 125 \nQ 2175 225 1725 225 \nQ 1625 225 1450 237 \nQ 1275 250 1050 275 \nQ 850 200 775 100 \nQ 700 0 700 -100 \nQ 700 -250 900 -350 \nQ 1100 -450 1600 -450 \nQ 2025 -450 2212 -337 \nQ 2400 -225 2400 -75 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-72\" d=\"M 2500 2425 \nQ 2025 2500 1700 2287 \nQ 1375 2075 1150 1550 \nL 1150 125 \nL 650 125 \nL 650 2925 \nL 1150 2925 \nL 1150 2200 \nQ 1375 2600 1712 2787 \nQ 2050 2975 2500 2975 \nL 2500 2425 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-61\" d=\"M 2875 125 \nL 2275 125 \nQ 2225 175 2200 262 \nQ 2175 350 2175 475 \nQ 2000 275 1750 175 \nQ 1500 75 1225 75 \nQ 825 75 550 275 \nQ 275 475 275 850 \nQ 275 1225 525 1450 \nQ 775 1675 1300 1750 \nQ 1650 1800 1912 1875 \nQ 2175 1950 2175 2075 \nQ 2175 2225 2062 2375 \nQ 1950 2525 1575 2525 \nQ 1275 2525 1137 2412 \nQ 1000 2300 950 2100 \nL 400 2100 \nQ 450 2500 762 2737 \nQ 1075 2975 1575 2975 \nQ 2125 2975 2400 2725 \nQ 2675 2475 2675 2025 \nL 2675 650 \nQ 2675 500 2725 375 \nQ 2775 250 2875 125 \nz\nM 2175 1050 \nL 2175 1550 \nQ 2025 1500 1887 1462 \nQ 1750 1425 1425 1375 \nQ 1050 1325 937 1200 \nQ 825 1075 825 900 \nQ 825 750 937 637 \nQ 1050 525 1275 525 \nQ 1500 525 1762 650 \nQ 2025 775 2175 1050 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-64\" d=\"M 2750 125 \nL 2250 125 \nL 2250 500 \nQ 2100 275 1900 175 \nQ 1700 75 1425 75 \nQ 925 75 575 437 \nQ 225 800 225 1525 \nQ 225 2250 575 2625 \nQ 925 3000 1425 3000 \nQ 1700 3000 1900 2887 \nQ 2100 2775 2250 2550 \nL 2250 4400 \nL 2750 4400 \nL 2750 125 \nz\nM 2250 1525 \nQ 2250 2000 2037 2275 \nQ 1825 2550 1525 2550 \nQ 1150 2550 962 2275 \nQ 775 2000 775 1525 \nQ 775 1050 962 787 \nQ 1150 525 1525 525 \nQ 1825 525 2037 787 \nQ 2250 1050 2250 1525 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-20\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-6f\" d=\"M 2925 1525 \nQ 2925 875 2525 475 \nQ 2125 75 1575 75 \nQ 1025 75 625 475 \nQ 225 875 225 1525 \nQ 225 2175 625 2575 \nQ 1025 2975 1575 2975 \nQ 2125 2975 2525 2575 \nQ 2925 2175 2925 1525 \nz\nM 2375 1525 \nQ 2375 2025 2125 2275 \nQ 1875 2525 1575 2525 \nQ 1275 2525 1025 2275 \nQ 775 2025 775 1525 \nQ 775 1025 1025 775 \nQ 1275 525 1575 525 \nQ 1875 525 2125 775 \nQ 2375 1025 2375 1525 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-66\" d=\"M 2850 3825 \nQ 2725 3900 2550 3950 \nQ 2375 4000 2100 4000 \nQ 1825 4000 1725 3862 \nQ 1625 3725 1625 3525 \nL 1625 2925 \nL 2650 2925 \nL 2650 2525 \nL 1625 2525 \nL 1625 125 \nL 1125 125 \nL 1125 2525 \nL 275 2525 \nL 275 2925 \nL 1125 2925 \nL 1125 3500 \nQ 1125 3950 1400 4200 \nQ 1675 4450 2125 4450 \nQ 2400 4450 2562 4412 \nQ 2725 4375 2850 4325 \nL 2850 3825 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-65\" d=\"M 2850 1075 \nQ 2800 625 2450 350 \nQ 2100 75 1625 75 \nQ 1025 75 637 462 \nQ 250 850 250 1525 \nQ 250 2200 637 2587 \nQ 1025 2975 1625 2975 \nQ 2150 2975 2487 2637 \nQ 2825 2300 2825 1525 \nL 800 1525 \nQ 800 975 1037 750 \nQ 1275 525 1625 525 \nQ 1900 525 2075 662 \nQ 2250 800 2300 1075 \nL 2850 1075 \nz\nM 2250 1925 \nQ 2200 2275 2025 2412 \nQ 1850 2550 1575 2550 \nQ 1325 2550 1125 2412 \nQ 925 2275 825 1925 \nL 2250 1925 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-6c\" d=\"M 1825 125 \nL 1325 125 \nL 1325 4400 \nL 1825 4400 \nL 1825 125 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-75\" d=\"M 2800 125 \nL 2300 125 \nL 2300 650 \nQ 2100 375 1862 225 \nQ 1625 75 1250 75 \nQ 800 75 575 325 \nQ 350 575 350 950 \nL 350 2925 \nL 850 2925 \nL 850 1125 \nQ 850 825 1000 650 \nQ 1150 475 1400 475 \nQ 1725 475 2012 812 \nQ 2300 1150 2300 1650 \nL 2300 2925 \nL 2800 2925 \nL 2800 125 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#SimHei-67\"/>\n      <use xlink:href=\"#SimHei-72\" x=\"50\"/>\n      <use xlink:href=\"#SimHei-61\" x=\"100\"/>\n      <use xlink:href=\"#SimHei-64\" x=\"150\"/>\n      <use xlink:href=\"#SimHei-20\" x=\"200\"/>\n      <use xlink:href=\"#SimHei-6f\" x=\"250\"/>\n      <use xlink:href=\"#SimHei-66\" x=\"300\"/>\n      <use xlink:href=\"#SimHei-20\" x=\"350\"/>\n      <use xlink:href=\"#SimHei-72\" x=\"400\"/>\n      <use xlink:href=\"#SimHei-65\" x=\"450\"/>\n      <use xlink:href=\"#SimHei-6c\" x=\"500\"/>\n      <use xlink:href=\"#SimHei-75\" x=\"550\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"line2d_31\">\n    <path d=\"M 54.084943 139.5 \nL 181.700727 139.5 \nL 183.295924 13.5 \nL 307.721307 13.5 \nL 307.721307 13.5 \n\" clip-path=\"url(#pa3bb8d26fc)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 41.403125 145.8 \nL 41.403125 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_4\">\n    <path d=\"M 320.403125 145.8 \nL 320.403125 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 41.403125 145.8 \nL 320.403125 145.8 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 41.403125 7.2 \nL 320.403125 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"pa3bb8d26fc\">\n   <rect x=\"41.403125\" y=\"7.2\" width=\"279\" height=\"138.6\"/>\n  </clipPath>\n </defs>\n</svg>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "y.backward(torch.ones_like(x), retain_graph=True)\n",
    "d2l.plot(x.detach(), x.grad, 'x', 'grad of relu', figsize=(5, 2.5))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-29T02:36:01.851197Z",
     "start_time": "2024-03-29T02:36:01.584604Z"
    }
   },
   "id": "aa0a0412f33096da",
   "execution_count": 3
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 4.1.2.2. sigmoid函数"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "5b312c64b6ab2d53"
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "<Figure size 500x250 with 1 Axes>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"328.4625pt\" height=\"180.25pt\" viewBox=\"0 0 328.4625 180.25\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2024-03-29T10:44:09.022569</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M 0 180.25 \nL 328.4625 180.25 \nL 328.4625 0 \nL 0 0 \nz\n\" style=\"fill: #ffffff\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 42.2625 145.8 \nL 321.2625 145.8 \nL 321.2625 7.2 \nL 42.2625 7.2 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g id=\"matplotlib.axis_1\">\n    <g id=\"xtick_1\">\n     <g id=\"line2d_1\">\n      <path d=\"M 54.944318 145.8 \nL 54.944318 7.2 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_2\">\n      <defs>\n       <path id=\"mbc9c87f18f\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#mbc9c87f18f\" x=\"54.944318\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- -8 -->\n      <g transform=\"translate(49.944318 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-2d\" d=\"M 2975 2125 \nL 125 2125 \nL 125 2525 \nL 2975 2525 \nL 2975 2125 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"SimHei-38\" d=\"M 175 1375 \nQ 175 1675 325 1962 \nQ 475 2250 825 2425 \nQ 525 2600 425 2812 \nQ 325 3025 312 3300 \nQ 300 3575 387 3775 \nQ 475 3975 650 4150 \nQ 825 4325 1037 4387 \nQ 1250 4450 1500 4450 \nQ 1750 4450 1950 4400 \nQ 2150 4350 2375 4187 \nQ 2600 4025 2700 3725 \nQ 2800 3425 2687 3025 \nQ 2575 2625 2100 2400 \nQ 2525 2275 2700 2012 \nQ 2875 1750 2875 1375 \nQ 2875 1000 2762 775 \nQ 2650 550 2512 400 \nQ 2375 250 2137 162 \nQ 1900 75 1537 75 \nQ 1175 75 912 162 \nQ 650 250 475 425 \nQ 300 600 237 837 \nQ 175 1075 175 1375 \nz\nM 687 1400 \nQ 675 1100 787 875 \nQ 900 650 1200 587 \nQ 1500 525 1825 600 \nQ 2150 675 2275 950 \nQ 2400 1225 2362 1500 \nQ 2325 1775 2050 1962 \nQ 1775 2150 1450 2125 \nQ 1125 2100 912 1900 \nQ 700 1700 687 1400 \nz\nM 775 3350 \nQ 775 3100 950 2875 \nQ 1125 2650 1500 2650 \nQ 1875 2650 2062 2875 \nQ 2250 3100 2237 3412 \nQ 2225 3725 2012 3875 \nQ 1800 4025 1437 4000 \nQ 1075 3975 925 3787 \nQ 775 3600 775 3350 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-38\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_3\">\n      <path d=\"M 86.848264 145.8 \nL 86.848264 7.2 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_4\">\n      <g>\n       <use xlink:href=\"#mbc9c87f18f\" x=\"86.848264\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- -6 -->\n      <g transform=\"translate(81.848264 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-36\" d=\"M 250 1612 \nQ 275 1975 387 2225 \nQ 500 2475 725 2850 \nL 1750 4450 \nL 2325 4450 \nL 1275 2800 \nQ 1950 2975 2350 2750 \nQ 2750 2525 2887 2237 \nQ 3025 1950 3037 1612 \nQ 3050 1275 2937 950 \nQ 2825 625 2537 362 \nQ 2250 100 1737 75 \nQ 1225 50 862 262 \nQ 500 475 362 862 \nQ 225 1250 250 1612 \nz\nM 1025 787 \nQ 1250 550 1625 525 \nQ 2000 500 2250 775 \nQ 2500 1050 2500 1575 \nQ 2500 2100 2187 2300 \nQ 1875 2500 1487 2450 \nQ 1100 2400 925 2075 \nQ 750 1750 775 1387 \nQ 800 1025 1025 787 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-36\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_5\">\n      <path d=\"M 118.75221 145.8 \nL 118.75221 7.2 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_6\">\n      <g>\n       <use xlink:href=\"#mbc9c87f18f\" x=\"118.75221\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- -4 -->\n      <g transform=\"translate(113.75221 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-34\" d=\"M 2000 1100 \nL 75 1100 \nL 75 1525 \nL 2100 4450 \nL 2475 4450 \nL 2475 1525 \nL 3075 1525 \nL 3075 1100 \nL 2475 1100 \nL 2475 150 \nL 2000 150 \nL 2000 1100 \nz\nM 2000 1525 \nL 2000 3500 \nL 600 1525 \nL 2000 1525 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-34\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_4\">\n     <g id=\"line2d_7\">\n      <path d=\"M 150.656156 145.8 \nL 150.656156 7.2 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_8\">\n      <g>\n       <use xlink:href=\"#mbc9c87f18f\" x=\"150.656156\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_4\">\n      <!-- -2 -->\n      <g transform=\"translate(145.656156 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-32\" d=\"M 300 250 \nQ 325 625 650 925 \nQ 975 1225 1475 1862 \nQ 1975 2500 2125 2850 \nQ 2275 3200 2237 3450 \nQ 2200 3700 2000 3862 \nQ 1800 4025 1537 4000 \nQ 1275 3975 1037 3800 \nQ 800 3625 675 3275 \nL 200 3350 \nQ 400 3925 712 4187 \nQ 1025 4450 1450 4475 \nQ 1700 4500 1900 4462 \nQ 2100 4425 2312 4287 \nQ 2525 4150 2662 3875 \nQ 2800 3600 2762 3212 \nQ 2725 2825 2375 2287 \nQ 2025 1750 1025 600 \nL 2825 600 \nL 2825 150 \nL 300 150 \nL 300 250 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-32\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_5\">\n     <g id=\"line2d_9\">\n      <path d=\"M 182.560102 145.8 \nL 182.560102 7.2 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_10\">\n      <g>\n       <use xlink:href=\"#mbc9c87f18f\" x=\"182.560102\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_5\">\n      <!-- 0 -->\n      <g transform=\"translate(180.060102 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-30\" d=\"M 225 2537 \nQ 250 3200 412 3587 \nQ 575 3975 875 4225 \nQ 1175 4475 1612 4475 \nQ 2050 4475 2375 4112 \nQ 2700 3750 2800 3200 \nQ 2900 2650 2862 1937 \nQ 2825 1225 2612 775 \nQ 2400 325 1975 150 \nQ 1550 -25 1125 187 \nQ 700 400 525 750 \nQ 350 1100 275 1487 \nQ 200 1875 225 2537 \nz\nM 750 2687 \nQ 675 2000 800 1462 \nQ 925 925 1212 700 \nQ 1500 475 1800 612 \nQ 2100 750 2237 1162 \nQ 2375 1575 2375 2062 \nQ 2375 2550 2337 2950 \nQ 2300 3350 2112 3675 \nQ 1925 4000 1612 4012 \nQ 1300 4025 1062 3700 \nQ 825 3375 750 2687 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_6\">\n     <g id=\"line2d_11\">\n      <path d=\"M 214.464048 145.8 \nL 214.464048 7.2 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_12\">\n      <g>\n       <use xlink:href=\"#mbc9c87f18f\" x=\"214.464048\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_6\">\n      <!-- 2 -->\n      <g transform=\"translate(211.964048 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-32\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_7\">\n     <g id=\"line2d_13\">\n      <path d=\"M 246.367993 145.8 \nL 246.367993 7.2 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_14\">\n      <g>\n       <use xlink:href=\"#mbc9c87f18f\" x=\"246.367993\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_7\">\n      <!-- 4 -->\n      <g transform=\"translate(243.867993 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-34\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_8\">\n     <g id=\"line2d_15\">\n      <path d=\"M 278.271939 145.8 \nL 278.271939 7.2 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_16\">\n      <g>\n       <use xlink:href=\"#mbc9c87f18f\" x=\"278.271939\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 6 -->\n      <g transform=\"translate(275.771939 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-36\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_9\">\n     <g id=\"line2d_17\">\n      <path d=\"M 310.175885 145.8 \nL 310.175885 7.2 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_18\">\n      <g>\n       <use xlink:href=\"#mbc9c87f18f\" x=\"310.175885\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_9\">\n      <!-- 8 -->\n      <g transform=\"translate(307.675885 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-38\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_10\">\n     <!-- x -->\n     <g transform=\"translate(179.2625 171.8) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"SimHei-78\" d=\"M 2875 125 \nL 2275 125 \nL 1550 1200 \nL 825 125 \nL 225 125 \nL 1250 1550 \nL 300 2925 \nL 900 2925 \nL 1550 1875 \nL 2200 2925 \nL 2800 2925 \nL 1850 1550 \nL 2875 125 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#SimHei-78\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_19\">\n      <path d=\"M 42.2625 139.542284 \nL 321.2625 139.542284 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_20\">\n      <defs>\n       <path id=\"m8623d79e40\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m8623d79e40\" x=\"42.2625\" y=\"139.542284\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_11\">\n      <!-- 0.0 -->\n      <g transform=\"translate(20.2625 142.979784) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-2e\" d=\"M 1075 125 \nL 500 125 \nL 500 675 \nL 1075 675 \nL 1075 125 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_21\">\n      <path d=\"M 42.2625 114.324481 \nL 321.2625 114.324481 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_22\">\n      <g>\n       <use xlink:href=\"#m8623d79e40\" x=\"42.2625\" y=\"114.324481\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_12\">\n      <!-- 0.2 -->\n      <g transform=\"translate(20.2625 117.761981) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-32\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_23\">\n      <path d=\"M 42.2625 89.106678 \nL 321.2625 89.106678 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_24\">\n      <g>\n       <use xlink:href=\"#m8623d79e40\" x=\"42.2625\" y=\"89.106678\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_13\">\n      <!-- 0.4 -->\n      <g transform=\"translate(20.2625 92.544178) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-34\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_4\">\n     <g id=\"line2d_25\">\n      <path d=\"M 42.2625 63.888875 \nL 321.2625 63.888875 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_26\">\n      <g>\n       <use xlink:href=\"#m8623d79e40\" x=\"42.2625\" y=\"63.888875\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_14\">\n      <!-- 0.6 -->\n      <g transform=\"translate(20.2625 67.326375) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-36\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_5\">\n     <g id=\"line2d_27\">\n      <path d=\"M 42.2625 38.671072 \nL 321.2625 38.671072 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_28\">\n      <g>\n       <use xlink:href=\"#m8623d79e40\" x=\"42.2625\" y=\"38.671072\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_15\">\n      <!-- 0.8 -->\n      <g transform=\"translate(20.2625 42.108572) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-38\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_6\">\n     <g id=\"line2d_29\">\n      <path d=\"M 42.2625 13.453269 \nL 321.2625 13.453269 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_30\">\n      <g>\n       <use xlink:href=\"#m8623d79e40\" x=\"42.2625\" y=\"13.453269\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_16\">\n      <!-- 1.0 -->\n      <g transform=\"translate(20.2625 16.890769) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-31\" d=\"M 1400 3600 \nQ 1075 3275 575 2975 \nL 575 3450 \nQ 1200 3875 1600 4450 \nL 1900 4450 \nL 1900 150 \nL 1400 150 \nL 1400 3600 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-31\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_17\">\n     <!-- sigmoid(x) -->\n     <g transform=\"translate(15.0125 101.5) rotate(-90) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"SimHei-73\" d=\"M 2750 900 \nQ 2750 500 2437 287 \nQ 2125 75 1650 75 \nQ 1050 75 725 312 \nQ 400 550 400 1000 \nL 900 1000 \nQ 900 700 1112 600 \nQ 1325 500 1625 500 \nQ 1925 500 2075 612 \nQ 2225 725 2225 900 \nQ 2225 1025 2100 1150 \nQ 1975 1275 1475 1350 \nQ 900 1425 687 1637 \nQ 475 1850 475 2200 \nQ 475 2500 762 2737 \nQ 1050 2975 1600 2975 \nQ 2100 2975 2387 2750 \nQ 2675 2525 2675 2150 \nL 2175 2150 \nQ 2175 2375 2012 2462 \nQ 1850 2550 1600 2550 \nQ 1275 2550 1137 2437 \nQ 1000 2325 1000 2175 \nQ 1000 2000 1125 1900 \nQ 1250 1800 1650 1750 \nQ 2300 1650 2525 1437 \nQ 2750 1225 2750 900 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-69\" d=\"M 1800 3725 \nL 1300 3725 \nL 1300 4375 \nL 1800 4375 \nL 1800 3725 \nz\nM 1800 125 \nL 1300 125 \nL 1300 2925 \nL 1800 2925 \nL 1800 125 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-67\" d=\"M 2975 2500 \nQ 2800 2550 2637 2562 \nQ 2475 2575 2300 2525 \nQ 2375 2450 2425 2337 \nQ 2475 2225 2475 2000 \nQ 2475 1575 2187 1300 \nQ 1900 1025 1475 1025 \nQ 1375 1025 1212 1062 \nQ 1050 1100 950 1150 \nQ 875 1100 850 1050 \nQ 825 1000 825 925 \nQ 825 800 1000 737 \nQ 1175 675 1625 675 \nQ 2350 675 2612 475 \nQ 2875 275 2875 -25 \nQ 2875 -425 2487 -612 \nQ 2100 -800 1575 -800 \nQ 900 -800 575 -625 \nQ 250 -450 250 -150 \nQ 250 0 375 150 \nQ 500 300 700 400 \nQ 550 475 462 587 \nQ 375 700 375 875 \nQ 375 1025 487 1137 \nQ 600 1250 750 1325 \nQ 625 1450 550 1625 \nQ 475 1800 475 2000 \nQ 475 2425 762 2700 \nQ 1050 2975 1475 2975 \nQ 1700 2975 1862 2912 \nQ 2025 2850 2150 2725 \nQ 2350 2875 2550 2937 \nQ 2750 3000 2975 2975 \nL 2975 2500 \nz\nM 1975 2000 \nQ 1975 2250 1850 2400 \nQ 1725 2550 1475 2550 \nQ 1225 2550 1100 2400 \nQ 975 2250 975 2000 \nQ 975 1750 1100 1600 \nQ 1225 1450 1475 1450 \nQ 1725 1450 1850 1600 \nQ 1975 1750 1975 2000 \nz\nM 2400 -75 \nQ 2400 25 2287 125 \nQ 2175 225 1725 225 \nQ 1625 225 1450 237 \nQ 1275 250 1050 275 \nQ 850 200 775 100 \nQ 700 0 700 -100 \nQ 700 -250 900 -350 \nQ 1100 -450 1600 -450 \nQ 2025 -450 2212 -337 \nQ 2400 -225 2400 -75 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-6d\" d=\"M 3050 125 \nL 2550 125 \nL 2550 2150 \nQ 2550 2300 2500 2400 \nQ 2450 2500 2300 2500 \nQ 2125 2500 1975 2312 \nQ 1825 2125 1825 1825 \nL 1825 125 \nL 1325 125 \nL 1325 2150 \nQ 1325 2300 1275 2400 \nQ 1225 2500 1075 2500 \nQ 900 2500 750 2312 \nQ 600 2125 600 1825 \nL 600 125 \nL 100 125 \nL 100 2925 \nL 600 2925 \nL 600 2550 \nQ 725 2750 900 2862 \nQ 1075 2975 1275 2975 \nQ 1475 2975 1612 2862 \nQ 1750 2750 1800 2550 \nQ 1925 2750 2087 2862 \nQ 2250 2975 2450 2975 \nQ 2750 2975 2900 2812 \nQ 3050 2650 3050 2350 \nL 3050 125 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-6f\" d=\"M 2925 1525 \nQ 2925 875 2525 475 \nQ 2125 75 1575 75 \nQ 1025 75 625 475 \nQ 225 875 225 1525 \nQ 225 2175 625 2575 \nQ 1025 2975 1575 2975 \nQ 2125 2975 2525 2575 \nQ 2925 2175 2925 1525 \nz\nM 2375 1525 \nQ 2375 2025 2125 2275 \nQ 1875 2525 1575 2525 \nQ 1275 2525 1025 2275 \nQ 775 2025 775 1525 \nQ 775 1025 1025 775 \nQ 1275 525 1575 525 \nQ 1875 525 2125 775 \nQ 2375 1025 2375 1525 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-64\" d=\"M 2750 125 \nL 2250 125 \nL 2250 500 \nQ 2100 275 1900 175 \nQ 1700 75 1425 75 \nQ 925 75 575 437 \nQ 225 800 225 1525 \nQ 225 2250 575 2625 \nQ 925 3000 1425 3000 \nQ 1700 3000 1900 2887 \nQ 2100 2775 2250 2550 \nL 2250 4400 \nL 2750 4400 \nL 2750 125 \nz\nM 2250 1525 \nQ 2250 2000 2037 2275 \nQ 1825 2550 1525 2550 \nQ 1150 2550 962 2275 \nQ 775 2000 775 1525 \nQ 775 1050 962 787 \nQ 1150 525 1525 525 \nQ 1825 525 2037 787 \nQ 2250 1050 2250 1525 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-28\" d=\"M 2975 -200 \nL 2700 -475 \nQ 2075 125 1762 775 \nQ 1450 1425 1450 2250 \nQ 1450 3075 1762 3725 \nQ 2075 4375 2700 5000 \nL 2975 4725 \nQ 2400 4175 2112 3587 \nQ 1825 3000 1825 2250 \nQ 1825 1500 2112 912 \nQ 2400 325 2975 -200 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-29\" d=\"M 1675 2250 \nQ 1675 1425 1362 775 \nQ 1050 125 425 -475 \nL 150 -200 \nQ 725 325 1012 912 \nQ 1300 1500 1300 2250 \nQ 1300 3000 1012 3587 \nQ 725 4175 150 4725 \nL 425 5000 \nQ 1050 4375 1362 3725 \nQ 1675 3075 1675 2250 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#SimHei-73\"/>\n      <use xlink:href=\"#SimHei-69\" x=\"50\"/>\n      <use xlink:href=\"#SimHei-67\" x=\"100\"/>\n      <use xlink:href=\"#SimHei-6d\" x=\"150\"/>\n      <use xlink:href=\"#SimHei-6f\" x=\"200\"/>\n      <use xlink:href=\"#SimHei-69\" x=\"250\"/>\n      <use xlink:href=\"#SimHei-64\" x=\"300\"/>\n      <use xlink:href=\"#SimHei-28\" x=\"350\"/>\n      <use xlink:href=\"#SimHei-78\" x=\"400\"/>\n      <use xlink:href=\"#SimHei-29\" x=\"450\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"line2d_31\">\n    <path d=\"M 54.944318 139.5 \nL 80.467473 139.333127 \nL 94.824251 139.029084 \nL 104.395433 138.610292 \nL 112.371419 138.013022 \nL 118.75221 137.27442 \nL 123.537801 136.500132 \nL 128.323392 135.470181 \nL 131.513788 134.603917 \nL 134.704183 133.562402 \nL 137.894578 132.314335 \nL 141.08497 130.82469 \nL 144.275365 129.055121 \nL 147.46576 126.964844 \nL 150.656156 124.512105 \nL 153.846549 121.656424 \nL 157.036945 118.361648 \nL 160.22734 114.599846 \nL 163.417733 110.355802 \nL 166.608129 105.631724 \nL 169.798523 100.451472 \nL 172.988918 94.863434 \nL 177.77451 85.884159 \nL 192.131286 58.132118 \nL 195.32168 52.54408 \nL 198.512075 47.363825 \nL 201.70247 42.639745 \nL 204.892863 38.395703 \nL 208.083259 34.633906 \nL 211.273654 31.339138 \nL 214.464048 28.483454 \nL 217.654443 26.030706 \nL 220.844838 23.94043 \nL 224.035234 22.170862 \nL 227.225629 20.681217 \nL 230.416021 19.433149 \nL 233.606416 18.391638 \nL 236.796811 17.525365 \nL 241.582402 16.495419 \nL 246.367993 15.721136 \nL 252.748784 14.982536 \nL 259.129575 14.482478 \nL 267.105561 14.079535 \nL 278.271939 13.765034 \nL 294.223912 13.568135 \nL 308.580682 13.5 \nL 308.580682 13.5 \n\" clip-path=\"url(#p46e93178a0)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 42.2625 145.8 \nL 42.2625 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_4\">\n    <path d=\"M 321.2625 145.8 \nL 321.2625 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 42.2625 145.8 \nL 321.2625 145.8 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 42.2625 7.2 \nL 321.2625 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"p46e93178a0\">\n   <rect x=\"42.2625\" y=\"7.2\" width=\"279\" height=\"138.6\"/>\n  </clipPath>\n </defs>\n</svg>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "y = torch.sigmoid(x)\n",
    "d2l.plot(x.detach(), y.detach(), 'x', 'sigmoid(x)', figsize=(5, 2.5))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-29T02:44:09.067217Z",
     "start_time": "2024-03-29T02:44:08.819811Z"
    }
   },
   "id": "a09227009fc3383c",
   "execution_count": 4
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "<Figure size 500x250 with 1 Axes>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"332.603125pt\" height=\"180.25pt\" viewBox=\"0 0 332.603125 180.25\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2024-03-29T10:45:34.636308</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M 0 180.25 \nL 332.603125 180.25 \nL 332.603125 0 \nL 0 0 \nz\n\" style=\"fill: #ffffff\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 46.403125 145.8 \nL 325.403125 145.8 \nL 325.403125 7.2 \nL 46.403125 7.2 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g id=\"matplotlib.axis_1\">\n    <g id=\"xtick_1\">\n     <g id=\"line2d_1\">\n      <path d=\"M 59.084943 145.8 \nL 59.084943 7.2 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_2\">\n      <defs>\n       <path id=\"m2ade232399\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m2ade232399\" x=\"59.084943\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- -8 -->\n      <g transform=\"translate(54.084943 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-2d\" d=\"M 2975 2125 \nL 125 2125 \nL 125 2525 \nL 2975 2525 \nL 2975 2125 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"SimHei-38\" d=\"M 175 1375 \nQ 175 1675 325 1962 \nQ 475 2250 825 2425 \nQ 525 2600 425 2812 \nQ 325 3025 312 3300 \nQ 300 3575 387 3775 \nQ 475 3975 650 4150 \nQ 825 4325 1037 4387 \nQ 1250 4450 1500 4450 \nQ 1750 4450 1950 4400 \nQ 2150 4350 2375 4187 \nQ 2600 4025 2700 3725 \nQ 2800 3425 2687 3025 \nQ 2575 2625 2100 2400 \nQ 2525 2275 2700 2012 \nQ 2875 1750 2875 1375 \nQ 2875 1000 2762 775 \nQ 2650 550 2512 400 \nQ 2375 250 2137 162 \nQ 1900 75 1537 75 \nQ 1175 75 912 162 \nQ 650 250 475 425 \nQ 300 600 237 837 \nQ 175 1075 175 1375 \nz\nM 687 1400 \nQ 675 1100 787 875 \nQ 900 650 1200 587 \nQ 1500 525 1825 600 \nQ 2150 675 2275 950 \nQ 2400 1225 2362 1500 \nQ 2325 1775 2050 1962 \nQ 1775 2150 1450 2125 \nQ 1125 2100 912 1900 \nQ 700 1700 687 1400 \nz\nM 775 3350 \nQ 775 3100 950 2875 \nQ 1125 2650 1500 2650 \nQ 1875 2650 2062 2875 \nQ 2250 3100 2237 3412 \nQ 2225 3725 2012 3875 \nQ 1800 4025 1437 4000 \nQ 1075 3975 925 3787 \nQ 775 3600 775 3350 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-38\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_3\">\n      <path d=\"M 90.988889 145.8 \nL 90.988889 7.2 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_4\">\n      <g>\n       <use xlink:href=\"#m2ade232399\" x=\"90.988889\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- -6 -->\n      <g transform=\"translate(85.988889 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-36\" d=\"M 250 1612 \nQ 275 1975 387 2225 \nQ 500 2475 725 2850 \nL 1750 4450 \nL 2325 4450 \nL 1275 2800 \nQ 1950 2975 2350 2750 \nQ 2750 2525 2887 2237 \nQ 3025 1950 3037 1612 \nQ 3050 1275 2937 950 \nQ 2825 625 2537 362 \nQ 2250 100 1737 75 \nQ 1225 50 862 262 \nQ 500 475 362 862 \nQ 225 1250 250 1612 \nz\nM 1025 787 \nQ 1250 550 1625 525 \nQ 2000 500 2250 775 \nQ 2500 1050 2500 1575 \nQ 2500 2100 2187 2300 \nQ 1875 2500 1487 2450 \nQ 1100 2400 925 2075 \nQ 750 1750 775 1387 \nQ 800 1025 1025 787 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-36\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_5\">\n      <path d=\"M 122.892835 145.8 \nL 122.892835 7.2 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_6\">\n      <g>\n       <use xlink:href=\"#m2ade232399\" x=\"122.892835\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- -4 -->\n      <g transform=\"translate(117.892835 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-34\" d=\"M 2000 1100 \nL 75 1100 \nL 75 1525 \nL 2100 4450 \nL 2475 4450 \nL 2475 1525 \nL 3075 1525 \nL 3075 1100 \nL 2475 1100 \nL 2475 150 \nL 2000 150 \nL 2000 1100 \nz\nM 2000 1525 \nL 2000 3500 \nL 600 1525 \nL 2000 1525 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-34\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_4\">\n     <g id=\"line2d_7\">\n      <path d=\"M 154.796781 145.8 \nL 154.796781 7.2 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_8\">\n      <g>\n       <use xlink:href=\"#m2ade232399\" x=\"154.796781\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_4\">\n      <!-- -2 -->\n      <g transform=\"translate(149.796781 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-32\" d=\"M 300 250 \nQ 325 625 650 925 \nQ 975 1225 1475 1862 \nQ 1975 2500 2125 2850 \nQ 2275 3200 2237 3450 \nQ 2200 3700 2000 3862 \nQ 1800 4025 1537 4000 \nQ 1275 3975 1037 3800 \nQ 800 3625 675 3275 \nL 200 3350 \nQ 400 3925 712 4187 \nQ 1025 4450 1450 4475 \nQ 1700 4500 1900 4462 \nQ 2100 4425 2312 4287 \nQ 2525 4150 2662 3875 \nQ 2800 3600 2762 3212 \nQ 2725 2825 2375 2287 \nQ 2025 1750 1025 600 \nL 2825 600 \nL 2825 150 \nL 300 150 \nL 300 250 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-32\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_5\">\n     <g id=\"line2d_9\">\n      <path d=\"M 186.700727 145.8 \nL 186.700727 7.2 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_10\">\n      <g>\n       <use xlink:href=\"#m2ade232399\" x=\"186.700727\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_5\">\n      <!-- 0 -->\n      <g transform=\"translate(184.200727 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-30\" d=\"M 225 2537 \nQ 250 3200 412 3587 \nQ 575 3975 875 4225 \nQ 1175 4475 1612 4475 \nQ 2050 4475 2375 4112 \nQ 2700 3750 2800 3200 \nQ 2900 2650 2862 1937 \nQ 2825 1225 2612 775 \nQ 2400 325 1975 150 \nQ 1550 -25 1125 187 \nQ 700 400 525 750 \nQ 350 1100 275 1487 \nQ 200 1875 225 2537 \nz\nM 750 2687 \nQ 675 2000 800 1462 \nQ 925 925 1212 700 \nQ 1500 475 1800 612 \nQ 2100 750 2237 1162 \nQ 2375 1575 2375 2062 \nQ 2375 2550 2337 2950 \nQ 2300 3350 2112 3675 \nQ 1925 4000 1612 4012 \nQ 1300 4025 1062 3700 \nQ 825 3375 750 2687 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_6\">\n     <g id=\"line2d_11\">\n      <path d=\"M 218.604673 145.8 \nL 218.604673 7.2 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_12\">\n      <g>\n       <use xlink:href=\"#m2ade232399\" x=\"218.604673\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_6\">\n      <!-- 2 -->\n      <g transform=\"translate(216.104673 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-32\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_7\">\n     <g id=\"line2d_13\">\n      <path d=\"M 250.508618 145.8 \nL 250.508618 7.2 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_14\">\n      <g>\n       <use xlink:href=\"#m2ade232399\" x=\"250.508618\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_7\">\n      <!-- 4 -->\n      <g transform=\"translate(248.008618 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-34\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_8\">\n     <g id=\"line2d_15\">\n      <path d=\"M 282.412564 145.8 \nL 282.412564 7.2 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_16\">\n      <g>\n       <use xlink:href=\"#m2ade232399\" x=\"282.412564\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 6 -->\n      <g transform=\"translate(279.912564 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-36\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_9\">\n     <g id=\"line2d_17\">\n      <path d=\"M 314.31651 145.8 \nL 314.31651 7.2 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_18\">\n      <g>\n       <use xlink:href=\"#m2ade232399\" x=\"314.31651\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_9\">\n      <!-- 8 -->\n      <g transform=\"translate(311.81651 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-38\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_10\">\n     <!-- x -->\n     <g transform=\"translate(183.403125 171.8) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"SimHei-78\" d=\"M 2875 125 \nL 2275 125 \nL 1550 1200 \nL 825 125 \nL 225 125 \nL 1250 1550 \nL 300 2925 \nL 900 2925 \nL 1550 1875 \nL 2200 2925 \nL 2800 2925 \nL 1850 1550 \nL 2875 125 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#SimHei-78\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_19\">\n      <path d=\"M 46.403125 139.669187 \nL 325.403125 139.669187 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_20\">\n      <defs>\n       <path id=\"ma2b199fa8e\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#ma2b199fa8e\" x=\"46.403125\" y=\"139.669187\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_11\">\n      <!-- 0.00 -->\n      <g transform=\"translate(19.403125 143.106687) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-2e\" d=\"M 1075 125 \nL 500 125 \nL 500 675 \nL 1075 675 \nL 1075 125 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"100\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"150\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_21\">\n      <path d=\"M 46.403125 114.435349 \nL 325.403125 114.435349 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_22\">\n      <g>\n       <use xlink:href=\"#ma2b199fa8e\" x=\"46.403125\" y=\"114.435349\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_12\">\n      <!-- 0.05 -->\n      <g transform=\"translate(19.403125 117.872849) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-35\" d=\"M 550 1325 \nQ 725 650 1150 575 \nQ 1575 500 1837 662 \nQ 2100 825 2212 1087 \nQ 2325 1350 2312 1675 \nQ 2300 2000 2137 2225 \nQ 1975 2450 1725 2525 \nQ 1475 2600 1162 2525 \nQ 850 2450 650 2175 \nL 225 2225 \nQ 275 2375 700 4375 \nL 2675 4375 \nL 2675 3925 \nL 1075 3925 \nQ 950 3250 825 2850 \nQ 1200 3025 1525 3012 \nQ 1850 3000 2150 2862 \nQ 2450 2725 2587 2487 \nQ 2725 2250 2787 2012 \nQ 2850 1775 2837 1500 \nQ 2825 1225 2725 937 \nQ 2625 650 2425 462 \nQ 2225 275 1937 162 \nQ 1650 50 1275 75 \nQ 900 100 562 350 \nQ 225 600 100 1200 \nL 550 1325 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"100\"/>\n       <use xlink:href=\"#SimHei-35\" x=\"150\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_23\">\n      <path d=\"M 46.403125 89.201512 \nL 325.403125 89.201512 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_24\">\n      <g>\n       <use xlink:href=\"#ma2b199fa8e\" x=\"46.403125\" y=\"89.201512\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_13\">\n      <!-- 0.10 -->\n      <g transform=\"translate(19.403125 92.639012) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-31\" d=\"M 1400 3600 \nQ 1075 3275 575 2975 \nL 575 3450 \nQ 1200 3875 1600 4450 \nL 1900 4450 \nL 1900 150 \nL 1400 150 \nL 1400 3600 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-31\" x=\"100\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"150\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_4\">\n     <g id=\"line2d_25\">\n      <path d=\"M 46.403125 63.967675 \nL 325.403125 63.967675 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_26\">\n      <g>\n       <use xlink:href=\"#ma2b199fa8e\" x=\"46.403125\" y=\"63.967675\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_14\">\n      <!-- 0.15 -->\n      <g transform=\"translate(19.403125 67.405175) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-31\" x=\"100\"/>\n       <use xlink:href=\"#SimHei-35\" x=\"150\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_5\">\n     <g id=\"line2d_27\">\n      <path d=\"M 46.403125 38.733837 \nL 325.403125 38.733837 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_28\">\n      <g>\n       <use xlink:href=\"#ma2b199fa8e\" x=\"46.403125\" y=\"38.733837\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_15\">\n      <!-- 0.20 -->\n      <g transform=\"translate(19.403125 42.171337) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-32\" x=\"100\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"150\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_6\">\n     <g id=\"line2d_29\">\n      <path d=\"M 46.403125 13.5 \nL 325.403125 13.5 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_30\">\n      <g>\n       <use xlink:href=\"#ma2b199fa8e\" x=\"46.403125\" y=\"13.5\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_16\">\n      <!-- 0.25 -->\n      <g transform=\"translate(19.403125 16.9375) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-32\" x=\"100\"/>\n       <use xlink:href=\"#SimHei-35\" x=\"150\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_17\">\n     <!-- grad of sigmoid -->\n     <g transform=\"translate(14.153125 114) rotate(-90) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"SimHei-67\" d=\"M 2975 2500 \nQ 2800 2550 2637 2562 \nQ 2475 2575 2300 2525 \nQ 2375 2450 2425 2337 \nQ 2475 2225 2475 2000 \nQ 2475 1575 2187 1300 \nQ 1900 1025 1475 1025 \nQ 1375 1025 1212 1062 \nQ 1050 1100 950 1150 \nQ 875 1100 850 1050 \nQ 825 1000 825 925 \nQ 825 800 1000 737 \nQ 1175 675 1625 675 \nQ 2350 675 2612 475 \nQ 2875 275 2875 -25 \nQ 2875 -425 2487 -612 \nQ 2100 -800 1575 -800 \nQ 900 -800 575 -625 \nQ 250 -450 250 -150 \nQ 250 0 375 150 \nQ 500 300 700 400 \nQ 550 475 462 587 \nQ 375 700 375 875 \nQ 375 1025 487 1137 \nQ 600 1250 750 1325 \nQ 625 1450 550 1625 \nQ 475 1800 475 2000 \nQ 475 2425 762 2700 \nQ 1050 2975 1475 2975 \nQ 1700 2975 1862 2912 \nQ 2025 2850 2150 2725 \nQ 2350 2875 2550 2937 \nQ 2750 3000 2975 2975 \nL 2975 2500 \nz\nM 1975 2000 \nQ 1975 2250 1850 2400 \nQ 1725 2550 1475 2550 \nQ 1225 2550 1100 2400 \nQ 975 2250 975 2000 \nQ 975 1750 1100 1600 \nQ 1225 1450 1475 1450 \nQ 1725 1450 1850 1600 \nQ 1975 1750 1975 2000 \nz\nM 2400 -75 \nQ 2400 25 2287 125 \nQ 2175 225 1725 225 \nQ 1625 225 1450 237 \nQ 1275 250 1050 275 \nQ 850 200 775 100 \nQ 700 0 700 -100 \nQ 700 -250 900 -350 \nQ 1100 -450 1600 -450 \nQ 2025 -450 2212 -337 \nQ 2400 -225 2400 -75 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-72\" d=\"M 2500 2425 \nQ 2025 2500 1700 2287 \nQ 1375 2075 1150 1550 \nL 1150 125 \nL 650 125 \nL 650 2925 \nL 1150 2925 \nL 1150 2200 \nQ 1375 2600 1712 2787 \nQ 2050 2975 2500 2975 \nL 2500 2425 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-61\" d=\"M 2875 125 \nL 2275 125 \nQ 2225 175 2200 262 \nQ 2175 350 2175 475 \nQ 2000 275 1750 175 \nQ 1500 75 1225 75 \nQ 825 75 550 275 \nQ 275 475 275 850 \nQ 275 1225 525 1450 \nQ 775 1675 1300 1750 \nQ 1650 1800 1912 1875 \nQ 2175 1950 2175 2075 \nQ 2175 2225 2062 2375 \nQ 1950 2525 1575 2525 \nQ 1275 2525 1137 2412 \nQ 1000 2300 950 2100 \nL 400 2100 \nQ 450 2500 762 2737 \nQ 1075 2975 1575 2975 \nQ 2125 2975 2400 2725 \nQ 2675 2475 2675 2025 \nL 2675 650 \nQ 2675 500 2725 375 \nQ 2775 250 2875 125 \nz\nM 2175 1050 \nL 2175 1550 \nQ 2025 1500 1887 1462 \nQ 1750 1425 1425 1375 \nQ 1050 1325 937 1200 \nQ 825 1075 825 900 \nQ 825 750 937 637 \nQ 1050 525 1275 525 \nQ 1500 525 1762 650 \nQ 2025 775 2175 1050 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-64\" d=\"M 2750 125 \nL 2250 125 \nL 2250 500 \nQ 2100 275 1900 175 \nQ 1700 75 1425 75 \nQ 925 75 575 437 \nQ 225 800 225 1525 \nQ 225 2250 575 2625 \nQ 925 3000 1425 3000 \nQ 1700 3000 1900 2887 \nQ 2100 2775 2250 2550 \nL 2250 4400 \nL 2750 4400 \nL 2750 125 \nz\nM 2250 1525 \nQ 2250 2000 2037 2275 \nQ 1825 2550 1525 2550 \nQ 1150 2550 962 2275 \nQ 775 2000 775 1525 \nQ 775 1050 962 787 \nQ 1150 525 1525 525 \nQ 1825 525 2037 787 \nQ 2250 1050 2250 1525 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-20\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-6f\" d=\"M 2925 1525 \nQ 2925 875 2525 475 \nQ 2125 75 1575 75 \nQ 1025 75 625 475 \nQ 225 875 225 1525 \nQ 225 2175 625 2575 \nQ 1025 2975 1575 2975 \nQ 2125 2975 2525 2575 \nQ 2925 2175 2925 1525 \nz\nM 2375 1525 \nQ 2375 2025 2125 2275 \nQ 1875 2525 1575 2525 \nQ 1275 2525 1025 2275 \nQ 775 2025 775 1525 \nQ 775 1025 1025 775 \nQ 1275 525 1575 525 \nQ 1875 525 2125 775 \nQ 2375 1025 2375 1525 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-66\" d=\"M 2850 3825 \nQ 2725 3900 2550 3950 \nQ 2375 4000 2100 4000 \nQ 1825 4000 1725 3862 \nQ 1625 3725 1625 3525 \nL 1625 2925 \nL 2650 2925 \nL 2650 2525 \nL 1625 2525 \nL 1625 125 \nL 1125 125 \nL 1125 2525 \nL 275 2525 \nL 275 2925 \nL 1125 2925 \nL 1125 3500 \nQ 1125 3950 1400 4200 \nQ 1675 4450 2125 4450 \nQ 2400 4450 2562 4412 \nQ 2725 4375 2850 4325 \nL 2850 3825 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-73\" d=\"M 2750 900 \nQ 2750 500 2437 287 \nQ 2125 75 1650 75 \nQ 1050 75 725 312 \nQ 400 550 400 1000 \nL 900 1000 \nQ 900 700 1112 600 \nQ 1325 500 1625 500 \nQ 1925 500 2075 612 \nQ 2225 725 2225 900 \nQ 2225 1025 2100 1150 \nQ 1975 1275 1475 1350 \nQ 900 1425 687 1637 \nQ 475 1850 475 2200 \nQ 475 2500 762 2737 \nQ 1050 2975 1600 2975 \nQ 2100 2975 2387 2750 \nQ 2675 2525 2675 2150 \nL 2175 2150 \nQ 2175 2375 2012 2462 \nQ 1850 2550 1600 2550 \nQ 1275 2550 1137 2437 \nQ 1000 2325 1000 2175 \nQ 1000 2000 1125 1900 \nQ 1250 1800 1650 1750 \nQ 2300 1650 2525 1437 \nQ 2750 1225 2750 900 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-69\" d=\"M 1800 3725 \nL 1300 3725 \nL 1300 4375 \nL 1800 4375 \nL 1800 3725 \nz\nM 1800 125 \nL 1300 125 \nL 1300 2925 \nL 1800 2925 \nL 1800 125 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-6d\" d=\"M 3050 125 \nL 2550 125 \nL 2550 2150 \nQ 2550 2300 2500 2400 \nQ 2450 2500 2300 2500 \nQ 2125 2500 1975 2312 \nQ 1825 2125 1825 1825 \nL 1825 125 \nL 1325 125 \nL 1325 2150 \nQ 1325 2300 1275 2400 \nQ 1225 2500 1075 2500 \nQ 900 2500 750 2312 \nQ 600 2125 600 1825 \nL 600 125 \nL 100 125 \nL 100 2925 \nL 600 2925 \nL 600 2550 \nQ 725 2750 900 2862 \nQ 1075 2975 1275 2975 \nQ 1475 2975 1612 2862 \nQ 1750 2750 1800 2550 \nQ 1925 2750 2087 2862 \nQ 2250 2975 2450 2975 \nQ 2750 2975 2900 2812 \nQ 3050 2650 3050 2350 \nL 3050 125 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#SimHei-67\"/>\n      <use xlink:href=\"#SimHei-72\" x=\"50\"/>\n      <use xlink:href=\"#SimHei-61\" x=\"100\"/>\n      <use xlink:href=\"#SimHei-64\" x=\"150\"/>\n      <use xlink:href=\"#SimHei-20\" x=\"200\"/>\n      <use xlink:href=\"#SimHei-6f\" x=\"250\"/>\n      <use xlink:href=\"#SimHei-66\" x=\"300\"/>\n      <use xlink:href=\"#SimHei-20\" x=\"350\"/>\n      <use xlink:href=\"#SimHei-73\" x=\"400\"/>\n      <use xlink:href=\"#SimHei-69\" x=\"450\"/>\n      <use xlink:href=\"#SimHei-67\" x=\"500\"/>\n      <use xlink:href=\"#SimHei-6d\" x=\"550\"/>\n      <use xlink:href=\"#SimHei-6f\" x=\"600\"/>\n      <use xlink:href=\"#SimHei-69\" x=\"650\"/>\n      <use xlink:href=\"#SimHei-64\" x=\"700\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"line2d_31\">\n    <path d=\"M 59.084943 139.5 \nL 73.44172 139.253462 \nL 83.012903 138.912712 \nL 90.988889 138.424397 \nL 97.36968 137.816687 \nL 102.155275 137.175006 \nL 106.940862 136.314067 \nL 111.726449 135.161385 \nL 114.916848 134.185253 \nL 118.10724 133.003565 \nL 121.297632 131.575826 \nL 124.488031 129.854907 \nL 127.678426 127.786619 \nL 130.868821 125.309608 \nL 134.059217 122.355806 \nL 137.249608 118.851768 \nL 140.440004 114.721215 \nL 143.630399 109.889367 \nL 146.820794 104.289473 \nL 150.011186 97.872081 \nL 153.201581 90.617285 \nL 156.391977 82.549746 \nL 159.582372 73.755506 \nL 164.367965 59.584618 \nL 170.748754 40.443712 \nL 173.939148 31.713935 \nL 175.534346 27.775856 \nL 177.129543 24.207097 \nL 178.72474 21.068279 \nL 180.319937 18.415173 \nL 181.915135 16.296758 \nL 183.510332 14.753321 \nL 185.105529 13.814889 \nL 186.700727 13.5 \nL 188.295924 13.814896 \nL 189.891121 14.753328 \nL 191.486319 16.296758 \nL 193.081516 18.415173 \nL 194.676713 21.068279 \nL 196.271911 24.207097 \nL 197.867108 27.775848 \nL 199.462305 31.713935 \nL 202.6527 40.44372 \nL 207.438291 54.732931 \nL 212.223884 69.133646 \nL 215.414279 78.235198 \nL 218.604673 86.681345 \nL 221.795068 94.349061 \nL 224.985463 101.185068 \nL 228.175859 107.189056 \nL 231.366254 112.397409 \nL 234.556646 116.869579 \nL 237.747041 120.677302 \nL 240.937436 123.89682 \nL 244.127832 126.603296 \nL 247.318223 128.867818 \nL 250.508618 130.755216 \nL 253.69901 132.323237 \nL 256.889409 133.622466 \nL 260.079801 134.696712 \nL 263.2702 135.583359 \nL 268.055795 136.629496 \nL 272.841382 137.410223 \nL 277.626969 137.991793 \nL 284.00776 138.54229 \nL 291.983747 138.98448 \nL 303.150125 139.328718 \nL 312.721307 139.482212 \nL 312.721307 139.482212 \n\" clip-path=\"url(#p17bc281e9b)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 46.403125 145.8 \nL 46.403125 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_4\">\n    <path d=\"M 325.403125 145.8 \nL 325.403125 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 46.403125 145.8 \nL 325.403125 145.8 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 46.403125 7.2 \nL 325.403125 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"p17bc281e9b\">\n   <rect x=\"46.403125\" y=\"7.2\" width=\"279\" height=\"138.6\"/>\n  </clipPath>\n </defs>\n</svg>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x.grad.data.zero_()\n",
    "y.backward(torch.ones_like(x), retain_graph=True)\n",
    "d2l.plot(x.detach(), x.grad, 'x', 'grad of sigmoid', figsize=(5, 2.5))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-29T02:45:34.680608Z",
     "start_time": "2024-03-29T02:45:34.453121Z"
    }
   },
   "id": "9cd7b737892a206a",
   "execution_count": 8
  },
  {
   "cell_type": "markdown",
   "source": [
    "#### 4.1.2.3. tanh函数"
   ],
   "metadata": {
    "collapsed": false
   },
   "id": "31ed02dc68fab89b"
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "<Figure size 500x250 with 1 Axes>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"332.954687pt\" height=\"180.25pt\" viewBox=\"0 0 332.954687 180.25\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2024-03-29T10:46:11.173558</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M 0 180.25 \nL 332.954687 180.25 \nL 332.954687 0 \nL 0 0 \nz\n\" style=\"fill: #ffffff\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 46.754688 145.8 \nL 325.754687 145.8 \nL 325.754687 7.2 \nL 46.754688 7.2 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g id=\"matplotlib.axis_1\">\n    <g id=\"xtick_1\">\n     <g id=\"line2d_1\">\n      <path d=\"M 59.436506 145.8 \nL 59.436506 7.2 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_2\">\n      <defs>\n       <path id=\"m59eb84f331\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m59eb84f331\" x=\"59.436506\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- -8 -->\n      <g transform=\"translate(54.436506 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-2d\" d=\"M 2975 2125 \nL 125 2125 \nL 125 2525 \nL 2975 2525 \nL 2975 2125 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"SimHei-38\" d=\"M 175 1375 \nQ 175 1675 325 1962 \nQ 475 2250 825 2425 \nQ 525 2600 425 2812 \nQ 325 3025 312 3300 \nQ 300 3575 387 3775 \nQ 475 3975 650 4150 \nQ 825 4325 1037 4387 \nQ 1250 4450 1500 4450 \nQ 1750 4450 1950 4400 \nQ 2150 4350 2375 4187 \nQ 2600 4025 2700 3725 \nQ 2800 3425 2687 3025 \nQ 2575 2625 2100 2400 \nQ 2525 2275 2700 2012 \nQ 2875 1750 2875 1375 \nQ 2875 1000 2762 775 \nQ 2650 550 2512 400 \nQ 2375 250 2137 162 \nQ 1900 75 1537 75 \nQ 1175 75 912 162 \nQ 650 250 475 425 \nQ 300 600 237 837 \nQ 175 1075 175 1375 \nz\nM 687 1400 \nQ 675 1100 787 875 \nQ 900 650 1200 587 \nQ 1500 525 1825 600 \nQ 2150 675 2275 950 \nQ 2400 1225 2362 1500 \nQ 2325 1775 2050 1962 \nQ 1775 2150 1450 2125 \nQ 1125 2100 912 1900 \nQ 700 1700 687 1400 \nz\nM 775 3350 \nQ 775 3100 950 2875 \nQ 1125 2650 1500 2650 \nQ 1875 2650 2062 2875 \nQ 2250 3100 2237 3412 \nQ 2225 3725 2012 3875 \nQ 1800 4025 1437 4000 \nQ 1075 3975 925 3787 \nQ 775 3600 775 3350 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-38\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_3\">\n      <path d=\"M 91.340452 145.8 \nL 91.340452 7.2 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_4\">\n      <g>\n       <use xlink:href=\"#m59eb84f331\" x=\"91.340452\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- -6 -->\n      <g transform=\"translate(86.340452 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-36\" d=\"M 250 1612 \nQ 275 1975 387 2225 \nQ 500 2475 725 2850 \nL 1750 4450 \nL 2325 4450 \nL 1275 2800 \nQ 1950 2975 2350 2750 \nQ 2750 2525 2887 2237 \nQ 3025 1950 3037 1612 \nQ 3050 1275 2937 950 \nQ 2825 625 2537 362 \nQ 2250 100 1737 75 \nQ 1225 50 862 262 \nQ 500 475 362 862 \nQ 225 1250 250 1612 \nz\nM 1025 787 \nQ 1250 550 1625 525 \nQ 2000 500 2250 775 \nQ 2500 1050 2500 1575 \nQ 2500 2100 2187 2300 \nQ 1875 2500 1487 2450 \nQ 1100 2400 925 2075 \nQ 750 1750 775 1387 \nQ 800 1025 1025 787 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-36\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_5\">\n      <path d=\"M 123.244397 145.8 \nL 123.244397 7.2 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_6\">\n      <g>\n       <use xlink:href=\"#m59eb84f331\" x=\"123.244397\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- -4 -->\n      <g transform=\"translate(118.244397 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-34\" d=\"M 2000 1100 \nL 75 1100 \nL 75 1525 \nL 2100 4450 \nL 2475 4450 \nL 2475 1525 \nL 3075 1525 \nL 3075 1100 \nL 2475 1100 \nL 2475 150 \nL 2000 150 \nL 2000 1100 \nz\nM 2000 1525 \nL 2000 3500 \nL 600 1525 \nL 2000 1525 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-34\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_4\">\n     <g id=\"line2d_7\">\n      <path d=\"M 155.148343 145.8 \nL 155.148343 7.2 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_8\">\n      <g>\n       <use xlink:href=\"#m59eb84f331\" x=\"155.148343\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_4\">\n      <!-- -2 -->\n      <g transform=\"translate(150.148343 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-32\" d=\"M 300 250 \nQ 325 625 650 925 \nQ 975 1225 1475 1862 \nQ 1975 2500 2125 2850 \nQ 2275 3200 2237 3450 \nQ 2200 3700 2000 3862 \nQ 1800 4025 1537 4000 \nQ 1275 3975 1037 3800 \nQ 800 3625 675 3275 \nL 200 3350 \nQ 400 3925 712 4187 \nQ 1025 4450 1450 4475 \nQ 1700 4500 1900 4462 \nQ 2100 4425 2312 4287 \nQ 2525 4150 2662 3875 \nQ 2800 3600 2762 3212 \nQ 2725 2825 2375 2287 \nQ 2025 1750 1025 600 \nL 2825 600 \nL 2825 150 \nL 300 150 \nL 300 250 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-32\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_5\">\n     <g id=\"line2d_9\">\n      <path d=\"M 187.052289 145.8 \nL 187.052289 7.2 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_10\">\n      <g>\n       <use xlink:href=\"#m59eb84f331\" x=\"187.052289\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_5\">\n      <!-- 0 -->\n      <g transform=\"translate(184.552289 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-30\" d=\"M 225 2537 \nQ 250 3200 412 3587 \nQ 575 3975 875 4225 \nQ 1175 4475 1612 4475 \nQ 2050 4475 2375 4112 \nQ 2700 3750 2800 3200 \nQ 2900 2650 2862 1937 \nQ 2825 1225 2612 775 \nQ 2400 325 1975 150 \nQ 1550 -25 1125 187 \nQ 700 400 525 750 \nQ 350 1100 275 1487 \nQ 200 1875 225 2537 \nz\nM 750 2687 \nQ 675 2000 800 1462 \nQ 925 925 1212 700 \nQ 1500 475 1800 612 \nQ 2100 750 2237 1162 \nQ 2375 1575 2375 2062 \nQ 2375 2550 2337 2950 \nQ 2300 3350 2112 3675 \nQ 1925 4000 1612 4012 \nQ 1300 4025 1062 3700 \nQ 825 3375 750 2687 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_6\">\n     <g id=\"line2d_11\">\n      <path d=\"M 218.956235 145.8 \nL 218.956235 7.2 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_12\">\n      <g>\n       <use xlink:href=\"#m59eb84f331\" x=\"218.956235\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_6\">\n      <!-- 2 -->\n      <g transform=\"translate(216.456235 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-32\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_7\">\n     <g id=\"line2d_13\">\n      <path d=\"M 250.860181 145.8 \nL 250.860181 7.2 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_14\">\n      <g>\n       <use xlink:href=\"#m59eb84f331\" x=\"250.860181\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_7\">\n      <!-- 4 -->\n      <g transform=\"translate(248.360181 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-34\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_8\">\n     <g id=\"line2d_15\">\n      <path d=\"M 282.764127 145.8 \nL 282.764127 7.2 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_16\">\n      <g>\n       <use xlink:href=\"#m59eb84f331\" x=\"282.764127\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 6 -->\n      <g transform=\"translate(280.264127 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-36\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_9\">\n     <g id=\"line2d_17\">\n      <path d=\"M 314.668073 145.8 \nL 314.668073 7.2 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_18\">\n      <g>\n       <use xlink:href=\"#m59eb84f331\" x=\"314.668073\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_9\">\n      <!-- 8 -->\n      <g transform=\"translate(312.168073 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-38\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_10\">\n     <!-- x -->\n     <g transform=\"translate(183.754687 171.8) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"SimHei-78\" d=\"M 2875 125 \nL 2275 125 \nL 1550 1200 \nL 825 125 \nL 225 125 \nL 1250 1550 \nL 300 2925 \nL 900 2925 \nL 1550 1875 \nL 2200 2925 \nL 2800 2925 \nL 1850 1550 \nL 2875 125 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#SimHei-78\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_19\">\n      <path d=\"M 46.754688 139.500015 \nL 325.754687 139.500015 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_20\">\n      <defs>\n       <path id=\"mf380097bd2\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#mf380097bd2\" x=\"46.754688\" y=\"139.500015\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_11\">\n      <!-- -1.0 -->\n      <g transform=\"translate(19.754688 142.937515) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-31\" d=\"M 1400 3600 \nQ 1075 3275 575 2975 \nL 575 3450 \nQ 1200 3875 1600 4450 \nL 1900 4450 \nL 1900 150 \nL 1400 150 \nL 1400 3600 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"SimHei-2e\" d=\"M 1075 125 \nL 500 125 \nL 500 675 \nL 1075 675 \nL 1075 125 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-31\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"100\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"150\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_21\">\n      <path d=\"M 46.754688 108.000007 \nL 325.754687 108.000007 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_22\">\n      <g>\n       <use xlink:href=\"#mf380097bd2\" x=\"46.754688\" y=\"108.000007\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_12\">\n      <!-- -0.5 -->\n      <g transform=\"translate(19.754688 111.437507) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-35\" d=\"M 550 1325 \nQ 725 650 1150 575 \nQ 1575 500 1837 662 \nQ 2100 825 2212 1087 \nQ 2325 1350 2312 1675 \nQ 2300 2000 2137 2225 \nQ 1975 2450 1725 2525 \nQ 1475 2600 1162 2525 \nQ 850 2450 650 2175 \nL 225 2225 \nQ 275 2375 700 4375 \nL 2675 4375 \nL 2675 3925 \nL 1075 3925 \nQ 950 3250 825 2850 \nQ 1200 3025 1525 3012 \nQ 1850 3000 2150 2862 \nQ 2450 2725 2587 2487 \nQ 2725 2250 2787 2012 \nQ 2850 1775 2837 1500 \nQ 2825 1225 2725 937 \nQ 2625 650 2425 462 \nQ 2225 275 1937 162 \nQ 1650 50 1275 75 \nQ 900 100 562 350 \nQ 225 600 100 1200 \nL 550 1325 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"100\"/>\n       <use xlink:href=\"#SimHei-35\" x=\"150\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_23\">\n      <path d=\"M 46.754688 76.499998 \nL 325.754687 76.499998 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_24\">\n      <g>\n       <use xlink:href=\"#mf380097bd2\" x=\"46.754688\" y=\"76.499998\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_13\">\n      <!-- 0.0 -->\n      <g transform=\"translate(24.754688 79.937498) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_4\">\n     <g id=\"line2d_25\">\n      <path d=\"M 46.754688 44.99999 \nL 325.754687 44.99999 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_26\">\n      <g>\n       <use xlink:href=\"#mf380097bd2\" x=\"46.754688\" y=\"44.99999\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_14\">\n      <!-- 0.5 -->\n      <g transform=\"translate(24.754688 48.43749) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-35\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_5\">\n     <g id=\"line2d_27\">\n      <path d=\"M 46.754688 13.499981 \nL 325.754687 13.499981 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_28\">\n      <g>\n       <use xlink:href=\"#mf380097bd2\" x=\"46.754688\" y=\"13.499981\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_15\">\n      <!-- 1.0 -->\n      <g transform=\"translate(24.754688 16.937481) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-31\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_16\">\n     <!-- tanh(x) -->\n     <g transform=\"translate(14.504688 94) rotate(-90) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"SimHei-74\" d=\"M 2750 200 \nQ 2625 150 2462 112 \nQ 2300 75 2025 75 \nQ 1575 75 1300 325 \nQ 1025 575 1025 1025 \nL 1025 2525 \nL 175 2525 \nL 175 2925 \nL 1025 2925 \nL 1025 3900 \nL 1525 3900 \nL 1525 2925 \nL 2550 2925 \nL 2550 2525 \nL 1525 2525 \nL 1525 1000 \nQ 1525 800 1625 662 \nQ 1725 525 2000 525 \nQ 2275 525 2450 575 \nQ 2625 625 2750 700 \nL 2750 200 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-61\" d=\"M 2875 125 \nL 2275 125 \nQ 2225 175 2200 262 \nQ 2175 350 2175 475 \nQ 2000 275 1750 175 \nQ 1500 75 1225 75 \nQ 825 75 550 275 \nQ 275 475 275 850 \nQ 275 1225 525 1450 \nQ 775 1675 1300 1750 \nQ 1650 1800 1912 1875 \nQ 2175 1950 2175 2075 \nQ 2175 2225 2062 2375 \nQ 1950 2525 1575 2525 \nQ 1275 2525 1137 2412 \nQ 1000 2300 950 2100 \nL 400 2100 \nQ 450 2500 762 2737 \nQ 1075 2975 1575 2975 \nQ 2125 2975 2400 2725 \nQ 2675 2475 2675 2025 \nL 2675 650 \nQ 2675 500 2725 375 \nQ 2775 250 2875 125 \nz\nM 2175 1050 \nL 2175 1550 \nQ 2025 1500 1887 1462 \nQ 1750 1425 1425 1375 \nQ 1050 1325 937 1200 \nQ 825 1075 825 900 \nQ 825 750 937 637 \nQ 1050 525 1275 525 \nQ 1500 525 1762 650 \nQ 2025 775 2175 1050 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-6e\" d=\"M 2800 125 \nL 2300 125 \nL 2300 1925 \nQ 2300 2225 2150 2400 \nQ 2000 2575 1750 2575 \nQ 1425 2575 1137 2237 \nQ 850 1900 850 1400 \nL 850 125 \nL 350 125 \nL 350 2925 \nL 850 2925 \nL 850 2400 \nQ 1050 2675 1287 2825 \nQ 1525 2975 1900 2975 \nQ 2350 2975 2575 2725 \nQ 2800 2475 2800 2100 \nL 2800 125 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-68\" d=\"M 2800 125 \nL 2300 125 \nL 2300 1925 \nQ 2300 2225 2150 2400 \nQ 2000 2575 1750 2575 \nQ 1425 2575 1137 2237 \nQ 850 1900 850 1400 \nL 850 125 \nL 350 125 \nL 350 4400 \nL 850 4400 \nL 850 2400 \nQ 1050 2675 1287 2825 \nQ 1525 2975 1900 2975 \nQ 2350 2975 2575 2725 \nQ 2800 2475 2800 2100 \nL 2800 125 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-28\" d=\"M 2975 -200 \nL 2700 -475 \nQ 2075 125 1762 775 \nQ 1450 1425 1450 2250 \nQ 1450 3075 1762 3725 \nQ 2075 4375 2700 5000 \nL 2975 4725 \nQ 2400 4175 2112 3587 \nQ 1825 3000 1825 2250 \nQ 1825 1500 2112 912 \nQ 2400 325 2975 -200 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-29\" d=\"M 1675 2250 \nQ 1675 1425 1362 775 \nQ 1050 125 425 -475 \nL 150 -200 \nQ 725 325 1012 912 \nQ 1300 1500 1300 2250 \nQ 1300 3000 1012 3587 \nQ 725 4175 150 4725 \nL 425 5000 \nQ 1050 4375 1362 3725 \nQ 1675 3075 1675 2250 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#SimHei-74\"/>\n      <use xlink:href=\"#SimHei-61\" x=\"50\"/>\n      <use xlink:href=\"#SimHei-6e\" x=\"100\"/>\n      <use xlink:href=\"#SimHei-68\" x=\"150\"/>\n      <use xlink:href=\"#SimHei-28\" x=\"200\"/>\n      <use xlink:href=\"#SimHei-78\" x=\"250\"/>\n      <use xlink:href=\"#SimHei-29\" x=\"300\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"line2d_29\">\n    <path d=\"M 59.436506 139.5 \nL 129.625188 139.406014 \nL 139.19637 139.188466 \nL 145.577157 138.80874 \nL 150.362748 138.246088 \nL 153.553144 137.638487 \nL 156.743539 136.742976 \nL 158.338737 136.148793 \nL 159.933934 135.430785 \nL 161.529132 134.565131 \nL 163.12433 133.524354 \nL 164.719527 132.277168 \nL 166.314723 130.788573 \nL 167.909921 129.020255 \nL 169.505119 126.93145 \nL 171.100316 124.480444 \nL 172.695513 121.626776 \nL 174.290711 118.334325 \nL 175.885908 114.575179 \nL 177.481105 110.334131 \nL 179.076303 105.613387 \nL 180.6715 100.43679 \nL 183.861894 88.934648 \nL 191.837881 58.147297 \nL 193.433078 52.563206 \nL 195.028276 47.386609 \nL 196.623473 42.665865 \nL 198.21867 38.424817 \nL 199.813868 34.665672 \nL 201.409065 31.373221 \nL 203.004262 28.519552 \nL 204.59946 26.068546 \nL 206.194657 23.979742 \nL 207.789853 22.211427 \nL 209.385051 20.722829 \nL 210.980249 19.475642 \nL 212.575446 18.434865 \nL 214.170644 17.569211 \nL 215.765842 16.851203 \nL 218.956235 15.766244 \nL 222.14663 15.028165 \nL 225.337026 14.528464 \nL 230.122617 14.066512 \nL 236.503408 13.75517 \nL 246.07459 13.576953 \nL 266.812154 13.5057 \nL 313.072869 13.5 \nL 313.072869 13.5 \n\" clip-path=\"url(#pee6ed0e8a6)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 46.754688 145.8 \nL 46.754688 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_4\">\n    <path d=\"M 325.754687 145.8 \nL 325.754687 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 46.754688 145.8 \nL 325.754688 145.8 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 46.754688 7.2 \nL 325.754688 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"pee6ed0e8a6\">\n   <rect x=\"46.754688\" y=\"7.2\" width=\"279\" height=\"138.6\"/>\n  </clipPath>\n </defs>\n</svg>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "y = torch.tanh(x)\n",
    "d2l.plot(x.detach(), y.detach(), 'x', 'tanh(x)', figsize=(5, 2.5))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-29T02:46:11.237799Z",
     "start_time": "2024-03-29T02:46:10.923616Z"
    }
   },
   "id": "eea6a63d32598f81",
   "execution_count": 9
  },
  {
   "cell_type": "code",
   "outputs": [
    {
     "data": {
      "text/plain": "<Figure size 500x250 with 1 Axes>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n<svg xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"327.603125pt\" height=\"180.25pt\" viewBox=\"0 0 327.603125 180.25\" xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n <metadata>\n  <rdf:RDF xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:cc=\"http://creativecommons.org/ns#\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">\n   <cc:Work>\n    <dc:type rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\"/>\n    <dc:date>2024-03-29T10:46:21.152236</dc:date>\n    <dc:format>image/svg+xml</dc:format>\n    <dc:creator>\n     <cc:Agent>\n      <dc:title>Matplotlib v3.7.2, https://matplotlib.org/</dc:title>\n     </cc:Agent>\n    </dc:creator>\n   </cc:Work>\n  </rdf:RDF>\n </metadata>\n <defs>\n  <style type=\"text/css\">*{stroke-linejoin: round; stroke-linecap: butt}</style>\n </defs>\n <g id=\"figure_1\">\n  <g id=\"patch_1\">\n   <path d=\"M -0 180.25 \nL 327.603125 180.25 \nL 327.603125 0 \nL -0 0 \nz\n\" style=\"fill: #ffffff\"/>\n  </g>\n  <g id=\"axes_1\">\n   <g id=\"patch_2\">\n    <path d=\"M 41.403125 145.8 \nL 320.403125 145.8 \nL 320.403125 7.2 \nL 41.403125 7.2 \nz\n\" style=\"fill: #ffffff\"/>\n   </g>\n   <g id=\"matplotlib.axis_1\">\n    <g id=\"xtick_1\">\n     <g id=\"line2d_1\">\n      <path d=\"M 54.084943 145.8 \nL 54.084943 7.2 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_2\">\n      <defs>\n       <path id=\"m9d2a656aba\" d=\"M 0 0 \nL 0 3.5 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m9d2a656aba\" x=\"54.084943\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_1\">\n      <!-- -8 -->\n      <g transform=\"translate(49.084943 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-2d\" d=\"M 2975 2125 \nL 125 2125 \nL 125 2525 \nL 2975 2525 \nL 2975 2125 \nz\n\" transform=\"scale(0.015625)\"/>\n        <path id=\"SimHei-38\" d=\"M 175 1375 \nQ 175 1675 325 1962 \nQ 475 2250 825 2425 \nQ 525 2600 425 2812 \nQ 325 3025 312 3300 \nQ 300 3575 387 3775 \nQ 475 3975 650 4150 \nQ 825 4325 1037 4387 \nQ 1250 4450 1500 4450 \nQ 1750 4450 1950 4400 \nQ 2150 4350 2375 4187 \nQ 2600 4025 2700 3725 \nQ 2800 3425 2687 3025 \nQ 2575 2625 2100 2400 \nQ 2525 2275 2700 2012 \nQ 2875 1750 2875 1375 \nQ 2875 1000 2762 775 \nQ 2650 550 2512 400 \nQ 2375 250 2137 162 \nQ 1900 75 1537 75 \nQ 1175 75 912 162 \nQ 650 250 475 425 \nQ 300 600 237 837 \nQ 175 1075 175 1375 \nz\nM 687 1400 \nQ 675 1100 787 875 \nQ 900 650 1200 587 \nQ 1500 525 1825 600 \nQ 2150 675 2275 950 \nQ 2400 1225 2362 1500 \nQ 2325 1775 2050 1962 \nQ 1775 2150 1450 2125 \nQ 1125 2100 912 1900 \nQ 700 1700 687 1400 \nz\nM 775 3350 \nQ 775 3100 950 2875 \nQ 1125 2650 1500 2650 \nQ 1875 2650 2062 2875 \nQ 2250 3100 2237 3412 \nQ 2225 3725 2012 3875 \nQ 1800 4025 1437 4000 \nQ 1075 3975 925 3787 \nQ 775 3600 775 3350 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-38\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_2\">\n     <g id=\"line2d_3\">\n      <path d=\"M 85.988889 145.8 \nL 85.988889 7.2 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_4\">\n      <g>\n       <use xlink:href=\"#m9d2a656aba\" x=\"85.988889\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_2\">\n      <!-- -6 -->\n      <g transform=\"translate(80.988889 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-36\" d=\"M 250 1612 \nQ 275 1975 387 2225 \nQ 500 2475 725 2850 \nL 1750 4450 \nL 2325 4450 \nL 1275 2800 \nQ 1950 2975 2350 2750 \nQ 2750 2525 2887 2237 \nQ 3025 1950 3037 1612 \nQ 3050 1275 2937 950 \nQ 2825 625 2537 362 \nQ 2250 100 1737 75 \nQ 1225 50 862 262 \nQ 500 475 362 862 \nQ 225 1250 250 1612 \nz\nM 1025 787 \nQ 1250 550 1625 525 \nQ 2000 500 2250 775 \nQ 2500 1050 2500 1575 \nQ 2500 2100 2187 2300 \nQ 1875 2500 1487 2450 \nQ 1100 2400 925 2075 \nQ 750 1750 775 1387 \nQ 800 1025 1025 787 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-36\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_3\">\n     <g id=\"line2d_5\">\n      <path d=\"M 117.892835 145.8 \nL 117.892835 7.2 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_6\">\n      <g>\n       <use xlink:href=\"#m9d2a656aba\" x=\"117.892835\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_3\">\n      <!-- -4 -->\n      <g transform=\"translate(112.892835 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-34\" d=\"M 2000 1100 \nL 75 1100 \nL 75 1525 \nL 2100 4450 \nL 2475 4450 \nL 2475 1525 \nL 3075 1525 \nL 3075 1100 \nL 2475 1100 \nL 2475 150 \nL 2000 150 \nL 2000 1100 \nz\nM 2000 1525 \nL 2000 3500 \nL 600 1525 \nL 2000 1525 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-34\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_4\">\n     <g id=\"line2d_7\">\n      <path d=\"M 149.796781 145.8 \nL 149.796781 7.2 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_8\">\n      <g>\n       <use xlink:href=\"#m9d2a656aba\" x=\"149.796781\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_4\">\n      <!-- -2 -->\n      <g transform=\"translate(144.796781 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-32\" d=\"M 300 250 \nQ 325 625 650 925 \nQ 975 1225 1475 1862 \nQ 1975 2500 2125 2850 \nQ 2275 3200 2237 3450 \nQ 2200 3700 2000 3862 \nQ 1800 4025 1537 4000 \nQ 1275 3975 1037 3800 \nQ 800 3625 675 3275 \nL 200 3350 \nQ 400 3925 712 4187 \nQ 1025 4450 1450 4475 \nQ 1700 4500 1900 4462 \nQ 2100 4425 2312 4287 \nQ 2525 4150 2662 3875 \nQ 2800 3600 2762 3212 \nQ 2725 2825 2375 2287 \nQ 2025 1750 1025 600 \nL 2825 600 \nL 2825 150 \nL 300 150 \nL 300 250 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-2d\"/>\n       <use xlink:href=\"#SimHei-32\" x=\"50\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_5\">\n     <g id=\"line2d_9\">\n      <path d=\"M 181.700727 145.8 \nL 181.700727 7.2 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_10\">\n      <g>\n       <use xlink:href=\"#m9d2a656aba\" x=\"181.700727\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_5\">\n      <!-- 0 -->\n      <g transform=\"translate(179.200727 159.675) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-30\" d=\"M 225 2537 \nQ 250 3200 412 3587 \nQ 575 3975 875 4225 \nQ 1175 4475 1612 4475 \nQ 2050 4475 2375 4112 \nQ 2700 3750 2800 3200 \nQ 2900 2650 2862 1937 \nQ 2825 1225 2612 775 \nQ 2400 325 1975 150 \nQ 1550 -25 1125 187 \nQ 700 400 525 750 \nQ 350 1100 275 1487 \nQ 200 1875 225 2537 \nz\nM 750 2687 \nQ 675 2000 800 1462 \nQ 925 925 1212 700 \nQ 1500 475 1800 612 \nQ 2100 750 2237 1162 \nQ 2375 1575 2375 2062 \nQ 2375 2550 2337 2950 \nQ 2300 3350 2112 3675 \nQ 1925 4000 1612 4012 \nQ 1300 4025 1062 3700 \nQ 825 3375 750 2687 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-30\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_6\">\n     <g id=\"line2d_11\">\n      <path d=\"M 213.604673 145.8 \nL 213.604673 7.2 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_12\">\n      <g>\n       <use xlink:href=\"#m9d2a656aba\" x=\"213.604673\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_6\">\n      <!-- 2 -->\n      <g transform=\"translate(211.104673 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-32\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_7\">\n     <g id=\"line2d_13\">\n      <path d=\"M 245.508618 145.8 \nL 245.508618 7.2 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_14\">\n      <g>\n       <use xlink:href=\"#m9d2a656aba\" x=\"245.508618\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_7\">\n      <!-- 4 -->\n      <g transform=\"translate(243.008618 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-34\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_8\">\n     <g id=\"line2d_15\">\n      <path d=\"M 277.412564 145.8 \nL 277.412564 7.2 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_16\">\n      <g>\n       <use xlink:href=\"#m9d2a656aba\" x=\"277.412564\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_8\">\n      <!-- 6 -->\n      <g transform=\"translate(274.912564 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-36\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"xtick_9\">\n     <g id=\"line2d_17\">\n      <path d=\"M 309.31651 145.8 \nL 309.31651 7.2 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_18\">\n      <g>\n       <use xlink:href=\"#m9d2a656aba\" x=\"309.31651\" y=\"145.8\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_9\">\n      <!-- 8 -->\n      <g transform=\"translate(306.81651 159.675) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-38\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_10\">\n     <!-- x -->\n     <g transform=\"translate(178.403125 171.8) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"SimHei-78\" d=\"M 2875 125 \nL 2275 125 \nL 1550 1200 \nL 825 125 \nL 225 125 \nL 1250 1550 \nL 300 2925 \nL 900 2925 \nL 1550 1875 \nL 2200 2925 \nL 2800 2925 \nL 1850 1550 \nL 2875 125 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#SimHei-78\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"matplotlib.axis_2\">\n    <g id=\"ytick_1\">\n     <g id=\"line2d_19\">\n      <path d=\"M 41.403125 139.50006 \nL 320.403125 139.50006 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_20\">\n      <defs>\n       <path id=\"m371b602319\" d=\"M 0 0 \nL -3.5 0 \n\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </defs>\n      <g>\n       <use xlink:href=\"#m371b602319\" x=\"41.403125\" y=\"139.50006\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_11\">\n      <!-- 0.0 -->\n      <g transform=\"translate(19.403125 142.93756) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-2e\" d=\"M 1075 125 \nL 500 125 \nL 500 675 \nL 1075 675 \nL 1075 125 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_2\">\n     <g id=\"line2d_21\">\n      <path d=\"M 41.403125 114.300048 \nL 320.403125 114.300048 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_22\">\n      <g>\n       <use xlink:href=\"#m371b602319\" x=\"41.403125\" y=\"114.300048\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_12\">\n      <!-- 0.2 -->\n      <g transform=\"translate(19.403125 117.737548) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-32\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_3\">\n     <g id=\"line2d_23\">\n      <path d=\"M 41.403125 89.100036 \nL 320.403125 89.100036 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_24\">\n      <g>\n       <use xlink:href=\"#m371b602319\" x=\"41.403125\" y=\"89.100036\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_13\">\n      <!-- 0.4 -->\n      <g transform=\"translate(19.403125 92.537536) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-34\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_4\">\n     <g id=\"line2d_25\">\n      <path d=\"M 41.403125 63.900024 \nL 320.403125 63.900024 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_26\">\n      <g>\n       <use xlink:href=\"#m371b602319\" x=\"41.403125\" y=\"63.900024\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_14\">\n      <!-- 0.6 -->\n      <g transform=\"translate(19.403125 67.337524) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-36\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_5\">\n     <g id=\"line2d_27\">\n      <path d=\"M 41.403125 38.700012 \nL 320.403125 38.700012 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_28\">\n      <g>\n       <use xlink:href=\"#m371b602319\" x=\"41.403125\" y=\"38.700012\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_15\">\n      <!-- 0.8 -->\n      <g transform=\"translate(19.403125 42.137512) scale(0.1 -0.1)\">\n       <use xlink:href=\"#SimHei-30\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-38\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"ytick_6\">\n     <g id=\"line2d_29\">\n      <path d=\"M 41.403125 13.5 \nL 320.403125 13.5 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #b0b0b0; stroke-width: 0.8; stroke-linecap: square\"/>\n     </g>\n     <g id=\"line2d_30\">\n      <g>\n       <use xlink:href=\"#m371b602319\" x=\"41.403125\" y=\"13.5\" style=\"stroke: #000000; stroke-width: 0.8\"/>\n      </g>\n     </g>\n     <g id=\"text_16\">\n      <!-- 1.0 -->\n      <g transform=\"translate(19.403125 16.9375) scale(0.1 -0.1)\">\n       <defs>\n        <path id=\"SimHei-31\" d=\"M 1400 3600 \nQ 1075 3275 575 2975 \nL 575 3450 \nQ 1200 3875 1600 4450 \nL 1900 4450 \nL 1900 150 \nL 1400 150 \nL 1400 3600 \nz\n\" transform=\"scale(0.015625)\"/>\n       </defs>\n       <use xlink:href=\"#SimHei-31\"/>\n       <use xlink:href=\"#SimHei-2e\" x=\"50\"/>\n       <use xlink:href=\"#SimHei-30\" x=\"100\"/>\n      </g>\n     </g>\n    </g>\n    <g id=\"text_17\">\n     <!-- grad of tanh -->\n     <g transform=\"translate(14.153125 106.5) rotate(-90) scale(0.1 -0.1)\">\n      <defs>\n       <path id=\"SimHei-67\" d=\"M 2975 2500 \nQ 2800 2550 2637 2562 \nQ 2475 2575 2300 2525 \nQ 2375 2450 2425 2337 \nQ 2475 2225 2475 2000 \nQ 2475 1575 2187 1300 \nQ 1900 1025 1475 1025 \nQ 1375 1025 1212 1062 \nQ 1050 1100 950 1150 \nQ 875 1100 850 1050 \nQ 825 1000 825 925 \nQ 825 800 1000 737 \nQ 1175 675 1625 675 \nQ 2350 675 2612 475 \nQ 2875 275 2875 -25 \nQ 2875 -425 2487 -612 \nQ 2100 -800 1575 -800 \nQ 900 -800 575 -625 \nQ 250 -450 250 -150 \nQ 250 0 375 150 \nQ 500 300 700 400 \nQ 550 475 462 587 \nQ 375 700 375 875 \nQ 375 1025 487 1137 \nQ 600 1250 750 1325 \nQ 625 1450 550 1625 \nQ 475 1800 475 2000 \nQ 475 2425 762 2700 \nQ 1050 2975 1475 2975 \nQ 1700 2975 1862 2912 \nQ 2025 2850 2150 2725 \nQ 2350 2875 2550 2937 \nQ 2750 3000 2975 2975 \nL 2975 2500 \nz\nM 1975 2000 \nQ 1975 2250 1850 2400 \nQ 1725 2550 1475 2550 \nQ 1225 2550 1100 2400 \nQ 975 2250 975 2000 \nQ 975 1750 1100 1600 \nQ 1225 1450 1475 1450 \nQ 1725 1450 1850 1600 \nQ 1975 1750 1975 2000 \nz\nM 2400 -75 \nQ 2400 25 2287 125 \nQ 2175 225 1725 225 \nQ 1625 225 1450 237 \nQ 1275 250 1050 275 \nQ 850 200 775 100 \nQ 700 0 700 -100 \nQ 700 -250 900 -350 \nQ 1100 -450 1600 -450 \nQ 2025 -450 2212 -337 \nQ 2400 -225 2400 -75 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-72\" d=\"M 2500 2425 \nQ 2025 2500 1700 2287 \nQ 1375 2075 1150 1550 \nL 1150 125 \nL 650 125 \nL 650 2925 \nL 1150 2925 \nL 1150 2200 \nQ 1375 2600 1712 2787 \nQ 2050 2975 2500 2975 \nL 2500 2425 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-61\" d=\"M 2875 125 \nL 2275 125 \nQ 2225 175 2200 262 \nQ 2175 350 2175 475 \nQ 2000 275 1750 175 \nQ 1500 75 1225 75 \nQ 825 75 550 275 \nQ 275 475 275 850 \nQ 275 1225 525 1450 \nQ 775 1675 1300 1750 \nQ 1650 1800 1912 1875 \nQ 2175 1950 2175 2075 \nQ 2175 2225 2062 2375 \nQ 1950 2525 1575 2525 \nQ 1275 2525 1137 2412 \nQ 1000 2300 950 2100 \nL 400 2100 \nQ 450 2500 762 2737 \nQ 1075 2975 1575 2975 \nQ 2125 2975 2400 2725 \nQ 2675 2475 2675 2025 \nL 2675 650 \nQ 2675 500 2725 375 \nQ 2775 250 2875 125 \nz\nM 2175 1050 \nL 2175 1550 \nQ 2025 1500 1887 1462 \nQ 1750 1425 1425 1375 \nQ 1050 1325 937 1200 \nQ 825 1075 825 900 \nQ 825 750 937 637 \nQ 1050 525 1275 525 \nQ 1500 525 1762 650 \nQ 2025 775 2175 1050 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-64\" d=\"M 2750 125 \nL 2250 125 \nL 2250 500 \nQ 2100 275 1900 175 \nQ 1700 75 1425 75 \nQ 925 75 575 437 \nQ 225 800 225 1525 \nQ 225 2250 575 2625 \nQ 925 3000 1425 3000 \nQ 1700 3000 1900 2887 \nQ 2100 2775 2250 2550 \nL 2250 4400 \nL 2750 4400 \nL 2750 125 \nz\nM 2250 1525 \nQ 2250 2000 2037 2275 \nQ 1825 2550 1525 2550 \nQ 1150 2550 962 2275 \nQ 775 2000 775 1525 \nQ 775 1050 962 787 \nQ 1150 525 1525 525 \nQ 1825 525 2037 787 \nQ 2250 1050 2250 1525 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-20\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-6f\" d=\"M 2925 1525 \nQ 2925 875 2525 475 \nQ 2125 75 1575 75 \nQ 1025 75 625 475 \nQ 225 875 225 1525 \nQ 225 2175 625 2575 \nQ 1025 2975 1575 2975 \nQ 2125 2975 2525 2575 \nQ 2925 2175 2925 1525 \nz\nM 2375 1525 \nQ 2375 2025 2125 2275 \nQ 1875 2525 1575 2525 \nQ 1275 2525 1025 2275 \nQ 775 2025 775 1525 \nQ 775 1025 1025 775 \nQ 1275 525 1575 525 \nQ 1875 525 2125 775 \nQ 2375 1025 2375 1525 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-66\" d=\"M 2850 3825 \nQ 2725 3900 2550 3950 \nQ 2375 4000 2100 4000 \nQ 1825 4000 1725 3862 \nQ 1625 3725 1625 3525 \nL 1625 2925 \nL 2650 2925 \nL 2650 2525 \nL 1625 2525 \nL 1625 125 \nL 1125 125 \nL 1125 2525 \nL 275 2525 \nL 275 2925 \nL 1125 2925 \nL 1125 3500 \nQ 1125 3950 1400 4200 \nQ 1675 4450 2125 4450 \nQ 2400 4450 2562 4412 \nQ 2725 4375 2850 4325 \nL 2850 3825 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-74\" d=\"M 2750 200 \nQ 2625 150 2462 112 \nQ 2300 75 2025 75 \nQ 1575 75 1300 325 \nQ 1025 575 1025 1025 \nL 1025 2525 \nL 175 2525 \nL 175 2925 \nL 1025 2925 \nL 1025 3900 \nL 1525 3900 \nL 1525 2925 \nL 2550 2925 \nL 2550 2525 \nL 1525 2525 \nL 1525 1000 \nQ 1525 800 1625 662 \nQ 1725 525 2000 525 \nQ 2275 525 2450 575 \nQ 2625 625 2750 700 \nL 2750 200 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-6e\" d=\"M 2800 125 \nL 2300 125 \nL 2300 1925 \nQ 2300 2225 2150 2400 \nQ 2000 2575 1750 2575 \nQ 1425 2575 1137 2237 \nQ 850 1900 850 1400 \nL 850 125 \nL 350 125 \nL 350 2925 \nL 850 2925 \nL 850 2400 \nQ 1050 2675 1287 2825 \nQ 1525 2975 1900 2975 \nQ 2350 2975 2575 2725 \nQ 2800 2475 2800 2100 \nL 2800 125 \nz\n\" transform=\"scale(0.015625)\"/>\n       <path id=\"SimHei-68\" d=\"M 2800 125 \nL 2300 125 \nL 2300 1925 \nQ 2300 2225 2150 2400 \nQ 2000 2575 1750 2575 \nQ 1425 2575 1137 2237 \nQ 850 1900 850 1400 \nL 850 125 \nL 350 125 \nL 350 4400 \nL 850 4400 \nL 850 2400 \nQ 1050 2675 1287 2825 \nQ 1525 2975 1900 2975 \nQ 2350 2975 2575 2725 \nQ 2800 2475 2800 2100 \nL 2800 125 \nz\n\" transform=\"scale(0.015625)\"/>\n      </defs>\n      <use xlink:href=\"#SimHei-67\"/>\n      <use xlink:href=\"#SimHei-72\" x=\"50\"/>\n      <use xlink:href=\"#SimHei-61\" x=\"100\"/>\n      <use xlink:href=\"#SimHei-64\" x=\"150\"/>\n      <use xlink:href=\"#SimHei-20\" x=\"200\"/>\n      <use xlink:href=\"#SimHei-6f\" x=\"250\"/>\n      <use xlink:href=\"#SimHei-66\" x=\"300\"/>\n      <use xlink:href=\"#SimHei-20\" x=\"350\"/>\n      <use xlink:href=\"#SimHei-74\" x=\"400\"/>\n      <use xlink:href=\"#SimHei-61\" x=\"450\"/>\n      <use xlink:href=\"#SimHei-6e\" x=\"500\"/>\n      <use xlink:href=\"#SimHei-68\" x=\"550\"/>\n     </g>\n    </g>\n   </g>\n   <g id=\"line2d_31\">\n    <path d=\"M 54.084943 139.5 \nL 113.10724 139.407309 \nL 122.678426 139.19236 \nL 129.059217 138.816302 \nL 133.844808 138.256944 \nL 137.035203 137.650038 \nL 140.225595 136.750129 \nL 141.820794 136.149434 \nL 143.41599 135.419707 \nL 145.011186 134.534263 \nL 146.606385 133.461463 \nL 148.201581 132.163957 \nL 149.796781 130.598053 \nL 151.391977 128.713213 \nL 152.987174 126.4517 \nL 154.582372 123.748806 \nL 156.17757 120.533634 \nL 157.772767 116.731015 \nL 159.367965 112.264841 \nL 160.963161 107.063464 \nL 162.558358 101.067532 \nL 164.153556 94.240673 \nL 165.748754 86.58327 \nL 167.34395 78.148441 \nL 170.534346 59.522835 \nL 173.72474 40.407602 \nL 175.319937 31.689527 \nL 176.915135 24.192751 \nL 178.510332 18.408584 \nL 180.105529 14.751648 \nL 181.700727 13.5 \nL 183.295924 14.751648 \nL 184.891121 18.408584 \nL 186.486319 24.192751 \nL 188.081516 31.689527 \nL 189.676713 40.407602 \nL 196.057503 78.148441 \nL 197.6527 86.58327 \nL 199.247897 94.240673 \nL 200.843095 101.067532 \nL 202.438291 107.063457 \nL 204.033488 112.264841 \nL 205.628686 116.731015 \nL 207.223884 120.533634 \nL 208.819081 123.748806 \nL 210.414279 126.4517 \nL 212.009475 128.713198 \nL 213.604673 130.598053 \nL 215.199868 132.163957 \nL 216.795068 133.461463 \nL 218.390264 134.534263 \nL 219.985463 135.419707 \nL 221.580659 136.149434 \nL 224.771054 137.244127 \nL 227.96145 137.98337 \nL 231.151845 138.481371 \nL 235.937436 138.939958 \nL 242.318223 139.248086 \nL 251.889409 139.424117 \nL 272.626969 139.494412 \nL 307.721307 139.499985 \nL 307.721307 139.499985 \n\" clip-path=\"url(#pfb69fdf471)\" style=\"fill: none; stroke: #1f77b4; stroke-width: 1.5; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_3\">\n    <path d=\"M 41.403125 145.8 \nL 41.403125 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_4\">\n    <path d=\"M 320.403125 145.8 \nL 320.403125 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_5\">\n    <path d=\"M 41.403125 145.8 \nL 320.403125 145.8 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n   <g id=\"patch_6\">\n    <path d=\"M 41.403125 7.2 \nL 320.403125 7.2 \n\" style=\"fill: none; stroke: #000000; stroke-width: 0.8; stroke-linejoin: miter; stroke-linecap: square\"/>\n   </g>\n  </g>\n </g>\n <defs>\n  <clipPath id=\"pfb69fdf471\">\n   <rect x=\"41.403125\" y=\"7.2\" width=\"279\" height=\"138.6\"/>\n  </clipPath>\n </defs>\n</svg>\n"
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 清除以前的梯度\n",
    "x.grad.data.zero_()\n",
    "y.backward(torch.ones_like(x),retain_graph=True)\n",
    "d2l.plot(x.detach(), x.grad, 'x', 'grad of tanh', figsize=(5, 2.5))"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2024-03-29T02:46:21.202286Z",
     "start_time": "2024-03-29T02:46:20.924312Z"
    }
   },
   "id": "4b00c021ff0c0aab",
   "execution_count": 10
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "60c59781d7ec0964"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
